-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update identity sample for v7 breaking changes (#825)
- Loading branch information
1 parent
276b3d7
commit 900cd52
Showing
2 changed files
with
12 additions
and
11 deletions.
There are no files selected for viewing
19 changes: 11 additions & 8 deletions
19
samples/net6.0/IdentitySample/Data/ApplicationDbContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
using Finbuckle.MultiTenant.EntityFrameworkCore; | ||
using Finbuckle.MultiTenant.Abstractions; | ||
using Finbuckle.MultiTenant.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace IdentitySample.Data; | ||
|
||
public class ApplicationDbContext : MultiTenantIdentityDbContext | ||
{ | ||
private readonly AppTenantInfo _tenantInfo; | ||
public ApplicationDbContext(IMultiTenantContextAccessor multiTenantContextAccessor, DbContextOptions options) : base(multiTenantContextAccessor, options) | ||
{ | ||
} | ||
|
||
public ApplicationDbContext(AppTenantInfo tenantInfo) : base(tenantInfo) | ||
public ApplicationDbContext(IMultiTenantContextAccessor multiTenantContextAccessor) : base(multiTenantContextAccessor) | ||
{ | ||
_tenantInfo = tenantInfo; | ||
} | ||
|
||
public ApplicationDbContext(AppTenantInfo tenantInfo, DbContextOptions options) : base(tenantInfo, options) | ||
public ApplicationDbContext(ITenantInfo tenantInfo) : base(tenantInfo) | ||
{ | ||
_tenantInfo = tenantInfo; | ||
// used for the design-time factory and progammatic migrations in program.cs | ||
} | ||
|
||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
optionsBuilder.UseSqlite(_tenantInfo.ConnectionString ?? throw new InvalidOperationException()); | ||
var tenantInfo = TenantInfo as AppTenantInfo; | ||
optionsBuilder.UseSqlite(tenantInfo?.ConnectionString ?? throw new InvalidOperationException()); | ||
base.OnConfiguring(optionsBuilder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters