Closed jimmywim closed 2 years ago
hi @jimmywim sorry for the late reply!
The short answer is that EFCore migrations are needed to initialize the schema on a fresh server. Nothing specific to Finbuckle here, but you'll want to check out the dotnet ef database update
command.
In many of my samples I programmatically initiallze and migrate to make them run smoother. You can do this as well if you prefer using the DbContext.Database
EnsureCreated
and ApplyMigrations
methods if I remember correctly.
Again, sorry for the late reply and I hope you find this library useful.
Hi @AndrewTriesToCode - thanks for the reply and clarification - I managed to get local working by hand-cranking it (which I prefer to do as I like using dacpacs in Azure DevOps pipelines for deployment). Good to know that there the migrations strategy will work if needed.
I'm quite happy with this library actually, I managed to get Tenant per Azure AD Tenancy working using the claims strategy and passing through the full Claim Type that AAD uses: http://schemas.microsoft.com/identity/claims/tenantid
- (noting this here in case anyone else stumbles across it whilst searching for the same solution).
I'll mark this as closed.
I'm intending on using this library to build a multi-tenant app, using
WithEFCoreStore()
.I'm following the sample code fine, and I have an existing tenant DB that I'm adding to the store (in
app.IsDevelopment()
) - but the big problem is the store's database doesn't exist!I'm using an
IOptions<T>
to hold the connection string to the database, which is injected fine into my store's DB Context type, and it usesoptionsBuilder.UseSqlServer()
passing in the (correct) connection string here, but nothing is creating the Store's DB if it doesn't exist.Do we need to manage the schema of that database outside of anything provided by MultiTenant? If so that's fine, and does the schema of the store's DB that we manage just follow the ITenantInfo shape in terms of properties, etc?
As a note, if I manually create an (empty) database for the store, the error I get when calling
TryAddAsync()
is:Does that suggest we create a table called TenantInfo to store the tenant details as per the ITenantInfo shape (especially if a custom type is inherting it with more properties)?
Any other tables needed by the EFCoreStore?