Design Time Instantiation Finbuckle V9 MultiTenantIdentityDbContext
In Finbuckle V8 the MultiTenantIdentityDbContext had a constructor that accepted an ITenantInfo object. In V9 the constructors for MultiTenantIdentityDbContext only accept IMultiTenantContextAccessor<> objects, which broke my design time instantiation.
Do you have any examples of design time instantiation with MultiTenantIdentityDbContext for V9? If not I am sure I will get something working later today...
Hi, there is now a factory Create method on MultiTenatDbContext that should let you spin up an instance easily for an IDesignTimeDbContextFactory<T> implementation. Does that work for you?
Hi Andrew...
It sure did... Should have looked at the updated documentation...
public sealed class IdentityApiDbContextDesignFactory : IDesignTimeDbContextFactory<MultiTenantIdentityDbContext>
{
public MultiTenantIdentityDbContext CreateDbContext(string[] args)
{
const string connectionString = "Server=.; THE REST OF THE CONNECTION STRING;";
var optionsBuilder = new DbContextOptionsBuilder<IdentityApiDbContext>();
optionsBuilder.UseSqlServer(connectionString);
var dbContext = MultiTenantDbContext.Create<MultiTenantIdentityDbContext, AppTenantInfo>(new AppTenantInfo(), optionsBuilder.Options);
return dbContext;
}
}
I was then able to build a migration and apply it
This issue has been labeled inactive because it has been open 30 days with no activity. This will be closed in 7 days without further activity.
edit: No this will not be closed--sorry about that!
This issue has been labeled inactive because it has been open 180 days with no activity. Please consider closing this issue if no further action is needed.