Skip to content

Commit

Permalink
Add DisableAutoMigrations support to AddMongoDbStores
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-michael authored and vova3211 committed Dec 23, 2024
1 parent 350c9c4 commit 92c8bce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/AspNetCore.Identity.Mongo/MongoStoreExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public static IdentityBuilder AddMongoDbStores<TUser, TRole, TKey>(this Identity
var userCollection = MongoUtil.FromConnectionString<TUser>(dbOptions, dbOptions.UsersCollection);
var roleCollection = MongoUtil.FromConnectionString<TRole>(dbOptions, dbOptions.RolesCollection);

Migrator.Apply<MigrationMongoUser<TKey>, TRole, TKey>(migrationCollection, migrationUserCollection,
roleCollection);
if (!dbOptions.DisableAutoMigrations)
{
Migrator.Apply<MigrationMongoUser<TKey>, TRole, TKey>(
migrationCollection, migrationUserCollection, roleCollection);
}

builder.Services.AddSingleton(x => userCollection);
builder.Services.AddSingleton(x => roleCollection);
Expand Down

0 comments on commit 92c8bce

Please # to comment.