1

I'm updating the EF model in a Web App, the App references the DLLs EntityFramework v4.0.30319 and EntityFramework.SQLserver v4.0.30319 I'm pretty sure this is EF6(?) and I wanted to create a new EF Model in a separate class library and kind of slide it in as a replacement.

I created a class library project with the intention of using

dotnet ef dbcontext scaffold ...

...to create the new model.

When I go to build,

[it wants the EntityFrameworkCore packages]

...and I'm building the new library ok.

My question is can I just update the Webb App with the packages and slide this model in, or should I try another approach. NuGet doesn't seem to have those old packages, and I don't think eftools will use them anyway?

4
  • 1
    "the App references the DLLs EntityFramework v4.0.30319 and EntityFramework.SQLserver v4.0.30319 I'm pretty sure this is EF6(?)" - no, that's the .NET Framework Runtime Version that is required. With a reference selected in the Solution Exporer window, look at the Version field in the Properties window. There you will see 6.0.0.0 for the EF assembly references. Commented Mar 8, 2022 at 10:01
  • "...I created a class library project with the intention of using dotnet ef dbcontext scaffold..." - I'm assuming you are keeping the original solution, why not right-click the solution and choose Add new project > Class library > .NET Standard/Core/5+ Commented Mar 8, 2022 at 10:08
  • "...it wants the EntityFrameworkCore packages...My question is can I just update the Webb App with the packages and slide this model in" - you can't just go and change the NuGet packages in a project from .NET Framework to .NET Core/.NET 5+ or vice versa because 1) they might be incompatible with the project type 2) even if the NuGet reference were successful, you may run into compilation errors. I'm not sure how it is now but once upon a time EF in .NET Core land was missing many features found in EF for a .NET Framework app Commented Mar 8, 2022 at 10:14
  • Thanks, I'm just stuck on how to generate the new dbcontext with the database change that I've made, The App is Web Form .NET 4.7.2 Framework, I don't have much experience with these. Commented Mar 8, 2022 at 10:53

1 Answer 1

2

I'm just stuck on how to generate the new dbcontext with the database change that I've made, The App is Web Form .NET 4.7.2 Framework

The last version of EF Core to have .NET Framework compatibility was 3.1. So for a .NET Framework application you should stick with EF 6.

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

2 Comments

Thanks David, what's the best way to generate dbcontext and associated POCO files, maybe I should ask another question for that?

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.