I created a .net core 2 class library. and I created the entities and entities type configurations. I created the DbContext
public class EFDBContext : DbContext
{
public EFDBContext(DbContextOptions options) : base(options)
{
}
}
then I created a TemporaryDbContextFactory
public class TemporaryDbContextFactory : IDesignTimeDbContextFactory<EFDBContext>
{
public EFDBContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<EFDBContext>();
builder.UseSqlServer("Name=AppConnectionString",
optionsBuilder => optionsBuilder.MigrationsAssembly(typeof(EFDBContext).GetTypeInfo().Assembly.GetName().Name));
return new EFDBContext(builder.Options);
}
}
I'm trying to run Add-Migration but I got nothing. the migration is not created
So what am I missing here ??
Sounds like you're hitting issue #10298 . Add the following to your *.csproj
file:
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.