简体   繁体   中英

Entity Framework 7 Reverse Engineering ASP.NET 5

I have been trying to migrate my database into web app model using EF7 _4.

Couple things I realized is that the syntax/approach how to configure particular entities has been changed.

Normally you generate POCO classes by using EF Power Tools (EF6), which generates entity types and entity map as configuration. All clean, all works.

My question is, does someone experience how to do it with EF7?

From the msdn blog I have found here about Entity Framework 7 Beta 4

the features for reverse engineering are still on dev phase. " An early preview of reverse engineering a model from a database ".

Here is something that will get you on your way. As you know its still all beta and this is a little complex but the best we have at the moment.

http://stoutcloud.com/geek-out-entity-framework-7/geek-ef7-reverse-engineering-first-look/

Just some commands to help along the way, since they changed a little since it changed to DNX. You can go into the command prompt or Powershell.

First make sure you install the relevant entity framework packages (as described in the above article). Make sure you get the latest and not beta1. I have found it needs to match the beta number of the DNX. Eg if you get DNX beta5 you need to download the nightly builds of EF of beta5.

Nightly build NuGet package source for reference: https://www.myget.org/F/aspnetvnext/api/v2

Don't forget to add this to your project.json

"commands": {
    "ef": "EntityFramework.Commands"
  }

Now on to the commands

dnvm install -r coreclr latest 

(or just use clr if you don't want the coreClr)

Go into the project directory then type

dnu restore

dnx . ef

dnx . ef revEng Server=PC\SQLEXPRESS;Database=Databasename;Trusted_Connection=True;

I have heard they are working on a GUI for this so we will just have to wait and see.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM