I just built up a bunch of POCO classes and a DbContext class utilizing EntityFramework Core and the Scaffold-DbContext NuGet Package Manager Console command.
It generated a bunch of code and most of it is fine, except there are several calls to HasColumnType and HasName methods that are not found by the compiler. Unfortunately, VS2017 isn't helping me locate them either. I installed EntityFramework Core via the NuGet Package Manager and I figured all dependencies would've been correctly installed, but this does not appear to be the case. I've tried googling the namespace for HasColumnType but have been unable to find it.
Could someone please tell me what namespace or NuGet package I'm missing?
These extensions are in the Microsoft.EntityFrameworkCore.Relational package as they are useful for modeling relational databases.
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Relational/
I also had the same question. As per this Microsoft docs link https://docs.microsoft.com/en-us/ef/core/providers/ you would need to add a specific database provider nuget package, such as Microsoft.EntityFrameworkCore.SqlServer
.
EF Core providers for relational databases are build on the common Microsoft.EntityFrameworkCore.Relational
library, which provides APIs for configuring table and column mappings, foreign key constraints, etc. Providers are usually distributed as NuGet packages.
So no need to add both packages, adding the more specific one Microsoft.EntityFrameworkCore.SqlServer
worked for me.