Closed Cpcrook closed 6 years ago
Hi Chris, thanks for the feedback I'll give you contributor.
For design time db context creation I recommend using a design time factory: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dbcontext-creation#from-a-design-time-factory
In the factory class construct the db context using the constructor that doesn't require a tenant context--internally this creates a dummy tenant context which will allows the expression to work. add-migration and other cli tools will ignore the tenant context.
Just looks like there needs to be some null-conditional checks added to allow migrations to apply happily.
var rightExp = Expression.Constant(tenantContext.Id, typeof(string));
should be
var rightExp = Expression.Constant(tenantContext?.Id, typeof(string));
I have a branch going I can submit a PR for (just need contributor permissions).