EF6 Code-first project - can I use it in .NET Core?

.net-core entity-framework entity-framework-6 entity-framework-core

Question

I have a database that I created using EF6. I have a VS project (library) that includes only my models and DbContext. Whenever I need to use my database I just reference that library DLL.

I have a few questions about that:

  1. What happens if I lose this DLL somehow, but still have my models? Am I able to recreate my library?
  2. What if I want to start using .NET Core? As far as I understand, I would have to use EF Core, right?. How can I get the same experience as I had with my DLL (same models).
1
0
4/5/2018 12:00:56 PM

Accepted Answer

  1. When you still have the Code of your Models you can simply recreate the DLL. It gets recreated as you rebuild anyway.

  2. You can also use the full entity framework together with .Net Core but that would make your application depending on classic .Net again.
    The entity framework core works similar in many ways and also a lot of the old annotations work. You should be able to port you Model easily from EF6 to EF Core if it is not to complicated. Just be aware of some limitations regarding group by that will be resolved in 2.1
    Because .Net Core is independent of the OS you won't be shuffeling around DLL's for you dependencys. One way is to use independet projects and release them as packages. So you can consume them in other projects with the package manager.

1
4/5/2018 12:05:29 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