diff --git a/src/AspNetCore.Identity.Mongo/MongoIdentityExtensions.cs b/src/AspNetCore.Identity.Mongo/MongoIdentityExtensions.cs index 6b0d4db..4d348b2 100644 --- a/src/AspNetCore.Identity.Mongo/MongoIdentityExtensions.cs +++ b/src/AspNetCore.Identity.Mongo/MongoIdentityExtensions.cs @@ -83,7 +83,8 @@ public static IdentityBuilder AddIdentityMongoDbProvider(thi var roleCollection = MongoUtil.FromConnectionString(dbOptions, dbOptions.RolesCollection); // apply migrations before identity services resolved - Migrator.Apply, TRole, TKey>(migrationCollection, migrationUserCollection, roleCollection); + if (!dbOptions.DisableAutoMigrations) + Migrator.Apply, TRole, TKey>(migrationCollection, migrationUserCollection, roleCollection); var builder = services.AddIdentity(setupIdentityAction ?? (x => { })); diff --git a/src/AspNetCore.Identity.Mongo/MongoIdentityOptions.cs b/src/AspNetCore.Identity.Mongo/MongoIdentityOptions.cs index 5467de7..2343e78 100644 --- a/src/AspNetCore.Identity.Mongo/MongoIdentityOptions.cs +++ b/src/AspNetCore.Identity.Mongo/MongoIdentityOptions.cs @@ -17,4 +17,6 @@ public class MongoIdentityOptions public SslSettings SslSettings { get; set; } public Action ClusterConfigurator { get; set; } + + public bool DisableAutoMigrations { get; set; } } \ No newline at end of file