How to generate EDMX file for EF6 in ASP.Net5 (Database first approach)

asp.net-core ef-database-first entity-framework-6

Question

I am trying to use EF6 in my ASP.Net5/MVC6 application, I installed the EF package from Nuget but I am not getting any template to generate the EDMX file (it was possible in previous veriosn of MVC). I found couple of article that talks about code first approach.

But how can I use DB first approach with EF6 and Asp.Net5, because I already have my database design ready. Can someone help me out here.

1
0
3/4/2016 5:13:38 PM

Popular Answer

there are some tutorials that you can see in youtube :

ASP.NET MVC 5 Step by Step: Part 5 Entity Framework Database First

Use ASP.NET Identity on existing DB-Model PART 1

and this is one sample of integration asp.net identity and EF Db First that I developed 2 years ago

you can use following method for generate .EDMX file in code first approach:

void ExportMappings(DbContext context, string edmxFile)
{
     var settings = new XmlWriterSettings { Indent = true };
     using (XmlWriter writer = XmlWriter.Create(edmxFile, settings))
     {
         System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(context, writer);
     }
}

if your database is already then you can use Entity Framework Power Tools for generate domain classes for using EF code First .

0
3/5/2016 5:31:48 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow