I have my site solution split into multiple projects, one of which has the classes for the Database. When I tried to generate the first migration I get the following error:
Entity Framework Core 2.0.3-rtm-10026 initialized 'SiteDBContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
Change your migrations assembly by using DbContextOptionsBuilder. E.g. options.UseSqlServer(connection, b => b.MigrationsAssembly("")). By default, the migrations assembly is the assembly containing the DbContext.
Change your target project to the migrations project by using the Package Manager Console's Default project drop-down list, or by executing "dotnet ef" from the directory containing the migrations project.
Your target project '' doesn't match your migrations assembly ''. Either change your target project or change your migrations assembly.
Change your migrations assembly by using DbContextOptionsBuilder. E.g. options.UseSqlServer(connection, b => b.MigrationsAssembly("")). By default, the migrations assembly is the assembly containing the DbContext. Change your target project to the migrations project by using the Package Manager Console's Default project drop-down list, or by executing "dotnet ef" from the directory containing the migrations project.
I want to add thie MigrationsAssembly option along side my connection string command but can't figure out exactly how to do it.
My current code is:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddDbContext<SiteDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("FFInfoDB")));
}
I tried:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddDbContext<SiteDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("FFInfoDB"), options.MigrationsAssembly("FFInfo.DAL")));
}
But I get the error
DbContextOptionsBuilder does not cainta a definition for MigrationsAssembly
What is the proper way to add in this second option?