mnj
mnj

Reputation: 3413

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

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).

Upvotes: 0

Views: 136

Answers (1)

Yush0
Yush0

Reputation: 1656

  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.

Upvotes: 1

Related Questions