0

I have a User Management Panel which is created on MVC dot net and Entity Framework Code first approach , entity framework being a separate class library build on dot net.

Now, I need to create an admin panel for it, and looking to create it on dot net core , However I plan to use the same database and EF Framework class library build on dot net standard.

Can This be achieved , that I keep a separate Project of Entity Framework .NET and it could be consumed by both .Net project as well as dot net core.

1 Answer 1

2

As you did not provide the versions of MVC, Entity Framework and .NET Core you (intend to) use it is difficult to give you precise advice.

.NET Core EF6 compatibillity

As is adviced in this article it is adviced to work with Entity Framework Core when working with .NET Core. However Entity Framework 6 also supports .NET Core applications. This information can be found in an overview from the Microsoft Entity Framework Documentation site where they compare EF6 with EF Core

EF Core 3.1 runs on .NET Core and .NET Framework, through the use of .NET Standard 2.0. However, EF Core 5.0 will not run on .NET Framework. ... EF6.4 runs on .NET Core and .NET Framework, through multi-targeting.

In the same article they also compare the feature compatibility between EF6 and EF Core. They also give advice for when upgrading your DAL to EF Core is beneficial/ required when working with existing projects.

Conclusion

You probably can use your existing Data Acces Layer written in EF6 with a .NET Core application however whether you should depends on the further development/ requirements of your application which you can find in this article.

Sign up to request clarification or add additional context in comments.

4 Comments

There would be other chanllenges as well considering, some of the dlls supported by .net , wont be supported by dot net core, leaving the complications, what do you think is the best way to go, as i want to have a seperate admin panel build on dot net core with existing database (which already been setup with entity framework 6) , i am using mvc 5
Do you wish to reuse the Data Access Layer code or only the database? Reusing the same database with a different DAL (written in EF Core) will definitely work however will have you duplicate a lot of your code. Using your existing DAL (using EF 6) will also work in your .Net Core project as long as you do not reference any .NET Core incompatible items. I recommend splitting your existing project into two project, one containg the Application logics for your UMP, the other containing the Data Acces Code (in a class library project). Then you can reuse the latter in your admin project
The EF6 project is already in a seperate project. Current Structure is as under: HelloWorld.API HelloWorld.BLL (Business Logic) HelloWorld.Data (EF) Ideally, i want to take this project also on .net core but not for now, i was thinking may be I can setup new core project as the following: NewHelloWorld.API, NewHelloWorld.BLL, NewHelloWorld.Data , can new EF Core Library 'NewHelloWorld.BLL' , and reference it in HelloWorld.BLL, this would make my life easy, i would be on an updated EF Framework and wont need to redo these things, what do you suggest?
your situation is not clear to me. Do you want to reference the new BL of the new project in the BL of your older project? If so how is this related to your original question? I assume only the DATA project contains EF references?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.