ef-database-first

How can I call a SQL Stored Procedure using EntityFramework 7 and Asp.Net 5

↘锁芯ラ 提交于 2019-11-27 02:02:30
For last couple of days I am searching for some tutorials about how to call a Stored Procedure from inside a Web API controller method using EntityFramework 7 . All tutorials I came through are showing it the other way round, i.e. Code First approach. But I already have a database in place and I need to use it to build a Web API . Various business logic are already written as Stored Procedures and Views and I have to consume those from my Web API. Question 1: Is this at all possible to carry on with Database First approach with EF7 and consume database objects like above? I installed

Modelling polymorphic associations database-first vs code-first

ε祈祈猫儿з 提交于 2019-11-26 12:45:35
问题 We have a database in which one table contains records that can be child to several other tables. It has a \"soft\" foreign key consisting of the owner\'s Id and a table name. This (anti) pattern is know as \"polymorphic associations\". We know it\'s not the best database design ever and we will change it in due time, but not in the near future. Let me show a simplified example: Both Event , Person , and Product have records in Comment. As you see, there are no hard FK constraints. In Entity

Entity Framework DB-First, implement inheritance

泄露秘密 提交于 2019-11-26 11:27:23
问题 I\'m trying to implement inheritance using entity framework 6.0 and database first approach. OK, let\'s say I have a Person and an Organization entity like below: // a simplified version of organization entity public class Organization { public Guid ID { get; set; } public string Nickname { get; set; } public string Email { get; set; } public string PhoneNumber { get; set; } public string OfficialName { get; set; } public Guid CEOID { get; set; } public DateTime? RegisterDate { get; set; } }

ASP.NET Identity with EF Database First MVC5

我是研究僧i 提交于 2019-11-26 06:29:45
Is it possible to use the new Asp.net Identity with Database First and EDMX? Or only with code first? Here's what I did: 1) I made a new MVC5 Project and had the new Identity create the new User and Roles tables in my database. 2) I then opened my Database First EDMX file and dragged in the new Identity Users table since I have other tables that relate to it. 3) Upon saving the EDMX, the Database First POCO generator will auto create a User class. However, UserManager and RoleManager expects a User class inheriting from the new Identity namespace (Microsoft.AspNet.Identity.IUser), so using the

ASP.NET Identity with EF Database First MVC5

心不动则不痛 提交于 2019-11-26 01:57:22
问题 Is it possible to use the new Asp.net Identity with Database First and EDMX? Or only with code first? Here\'s what I did: 1) I made a new MVC5 Project and had the new Identity create the new User and Roles tables in my database. 2) I then opened my Database First EDMX file and dragged in the new Identity Users table since I have other tables that relate to it. 3) Upon saving the EDMX, the Database First POCO generator will auto create a User class. However, UserManager and RoleManager expects

Code-first vs Model/Database-first [closed]

最后都变了- 提交于 2019-11-25 21:57:59
问题 What are the pros & cons of using Entity Framework 4.1 Code-first over Model/Database-first with EDMX diagram? I\'m trying to fully understand all the approaches to building data access layer using EF 4.1. I\'m using Repository pattern and IoC . I know I can use code-first approach: define my entities and context by hand and use ModelBuilder to fine-tune the schema. I can also create an EDMX diagram and choose a code generation step that uses T4 templates to generate the same POCO classes. In