Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ protected IdentityUserContext() { }
/// <summary>
/// Gets the schema version used for versioning.
/// </summary>
[Obsolete("SchemaVersion is not used by IdentityUserContext. Configure the schema version using IdentityOptions.Stores.SchemaVersion instead.")]
protected virtual Version SchemaVersion { get => GetStoreOptions()?.SchemaVersion ?? IdentitySchemaVersions.Version1; }

private StoreOptions? GetStoreOptions() => this.GetService<IDbContextOptions>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public EmptyDbContext(DbContextOptions options)

protected override void OnModelCreating(ModelBuilder builder)
{
if (SchemaVersion >= new Version(10, 0))
var storeOptions = this.GetService<Microsoft.Extensions.Options.IOptions<IdentityOptions>>()?.Value?.Stores;
var schemaVersion = storeOptions?.SchemaVersion ?? IdentitySchemaVersions.Version1;

if (schemaVersion >= new Version(10, 0))
{
builder.Ignore<IdentityUser>();

Expand Down Expand Up @@ -84,7 +87,10 @@ protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);

if (SchemaVersion >= new Version(3, 0))
var storeOptions = this.GetService<Microsoft.Extensions.Options.IOptions<IdentityOptions>>()?.Value?.Stores;
var schemaVersion = storeOptions?.SchemaVersion ?? IdentitySchemaVersions.Version1;

if (schemaVersion >= new Version(3, 0))
{
builder.Entity<CustomColumn>(b =>
{
Expand Down
Loading