Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the EDMX

Getting exposed to dotnet Core. In a sample test application trying to setup EntityFramework.Core in dotnet core app. While I was able to add the EntityFramework.Core NugGet package I can't find the 'Add'->'New Item'->'Data'->'ADO.NET Entity Data Model'

Is this not possible with EntityFramework.Core?

How does EntityFramework.Core differ from EntityFramework 7?

like image 865
barrypicker Avatar asked Sep 20 '16 17:09

barrypicker


People also ask

How do I view an EDMX file?

Exploring the EDMX file edmx file > Open With.. > XML (Text) Editor > OK. Once you open Model1. edmx in the XML Editor, pay attention to the 3 main sections in the file: SSDL, CSDL and C-S mapping.

What is the EDMX file?

An . edmx file is an XML file that defines an Entity Data Model (EDM), describes the target database schema, and defines the mapping between the EDM and the database. An . edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.

Does EF core has EDMX file?

EF Core does not support the EDMX file format for models. The best option to port these models, is to generate a new code-based model from the database for your application.

How do I use EDMX in .NET core?

There is no edmx support in Entity Framework Core. It only supports a code-first approach. The option to add a new Entity Data Model will be added, but it will produce entity class files instead of an edmx file. The tooling development is a little bit behind the framework development currently.


2 Answers

There is no edmx support in Entity Framework Core. It only supports a code-first approach. The option to add a new Entity Data Model will be added, but it will produce entity class files instead of an edmx file. The tooling development is a little bit behind the framework development currently.

like image 98
Mike Brind Avatar answered Oct 05 '22 18:10

Mike Brind


Still no EDMX support yet for .Net core. To generate the dbcontext and entities from database, run below command in package manager console:

Scaffold-DbContext "Server=yourserver;Database=yourdatabase;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models 

See details in https://docs.microsoft.com/en-us/ef/efcore-and-ef6/porting/port-edmx

You will need these packages:

Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Tools Microsoft.EntityFrameworkCore.SqlServer.Design 

https://ef.readthedocs.io/en/staging/platforms/aspnetcore/existing-db.html#install-entity-framework

like image 33
suomi-dev Avatar answered Oct 05 '22 19:10

suomi-dev