Where is HasDefaultSchema in Entity Framework Core?
UPDATE: Net Core 5.0
Microsoft.EntityFrameworkCore.Relational
I am using SQL Server as the Database, so in this case I had to
- Install both
Microsoft.EntityFrameworkCore
andMicrosoft.EntityFrameworkCore.SqlServer
packages, and, - Include
using Microsoft.EntityFrameworkCore;
Note, only installing Microsoft.EntityFrameworkCore
will complain that 'HasDefaultSchema ' is undefined, and also VS would not provide any suggestion to install the other package.
It's exactly the same as the sample code.
The only difference with EF6 is that as most of the EF Core fluent (and not only) method it's implemented as extension method (rather than instance method) of the ModelBuilder
class inside the RelationalModelBuilderExtensions
class.
In order to use it, make sure you reference the Microsoft.EntityFrameworkCore.Relational nuget, and have using Microsoft.EntityFrameworkCore;