3

Newbie ALERT!

I've seen a lot of questions regarding this issue and the fixes are for earlier versions that are not working for me. I keep hitting a brick wall no matter what process, tutorial, or anything I try to follow.

I've learned a lot about the differences between Framework, Core, and Standard. I have found that the ADO.NET Entity Data Model is included in a Framework project. I've seen lots of tutorials that guide the viewer through the process of adding EntityFrameworkCore packages from NuGet with the promise of adding ADO.NET Entity Data Model to a Core or Standard project. But after adding the EntityFrameworkCore packages, the ADO.NET Entity Data Model is still missing from my Core and Standard projects. In all tutorials, the next step in the process is to connect to the database via the Entity Data Model Wizard (shown in the fifth image below).

I've created a solution with a Core Class Library, a Standard Class Library, and a Framework Class Library, so I could test them. Here is my solution:

enter image description here

You can see that I have added the EntityFrameworkCore packages in both the Core and Standard Class Library projects. From the Framework Class Library project, when I select Add New Item, ADO.NET Entity Data Model is listed.

Framework Add New Item

From the Core and Standard Class Library projects, when I select Add New Item, ADO.NET Entity Data Model is not there.

Core Add New Item

Standard Add New Item

Entity Data Model Wizard

So, my question is: Is it possible to create ORM data classes and an EDMX diagram in Visual Studio 2019 in a Core or Standard (NOT Framework) project? If YES, please point me in the correct direction. Thank you in advance.

Patricia
  • 5,019
  • 14
  • 72
  • 152
  • 3
    " ORM data classes " Yes, possible. "an EDMX diagram" - It is not possible. Use Scaffold -Dbcontext https://learn.microsoft.com/en-us/ef/core/managing-schemas/scaffolding?tabs=dotnet-core-cli – 3per Nov 12 '20 at 23:02
  • 2
    Hi I think its not quite possible. Please check this https://stackoverflow.com/questions/50790071/cant-add-ado-net-entity-data-model-to-net-core-2-1-project – Gnyasha Nov 12 '20 at 23:18
  • 2
    You can right click add > New Item > Dataset > and once you have added the dataset then you can drag and drop your tables from the server explorer on the visual designer but it wont be an edmx, it will be a an xsd. – Gnyasha Nov 12 '20 at 23:33
  • @3per - Thank you so much for your input. I took awhile to look at both options and learned a lot. I finally got the database first working by using this link: https://www.entityframeworktutorial.net/efcore/create-model-for-existing-database-in-ef-core.aspx – Patricia Nov 16 '20 at 22:27
  • 2
    @Gnyasha - I liked your suggestion but still have a little bit more to understand how that works. I ended up getting it to work by using this link: https://www.entityframeworktutorial.net/efcore/create-model-for-existing-database-in-ef-core.aspx – Patricia Nov 16 '20 at 22:29
  • 2
    @Patricia, I noticed a phrase by your link *"Once you have created the model, you must use the Migration commands"* I disagree with "must". You can use `Scaffold-Dbcontext ... -Force` to work "database first" always. – 3per Nov 16 '20 at 23:35
  • @3per - Correct. I didn't follow the tutorial to the end. As soon as I had my classes I stopped.....HAPPY. – Patricia Nov 17 '20 at 18:16

0 Answers0