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

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

Question

I installed the EF package from Nuget while I was trying to use EF6 in my ASP.Net5/MVC6 application, however I did not receive any templates to create the EDMX file (it was possible in previous veriosn of MVC). I came across a few articles that discuss the "code first" methodology.

But how can I apply the DB first technique with EF6 and Asp.Net5 when my database design is already complete? Can someone please assist me here?

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

Popular Answer

You can view the following tutorials on YouTube:

Entity Framework Database First in Part 5 of the ASP.NET MVC 5 Step by Step guide

Use an existing DB-Model with ASP.NET Identity PART 1

and Here is one example. of integration between EF Db First and Asp.net Identity, which I created two years ago.

To create an.EDMX file using the code first method, utilize the following technique:

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);
     }
}

You can use Powerful Entity Framework Tools to generate domain classes for using EF code First if your database is already set up.

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