diff --git a/src/persistence/Elsa.Persistence.EntityFramework/Elsa.Persistence.EntityFramework.Core/Extensions/ServiceCollectionExtensions.cs b/src/persistence/Elsa.Persistence.EntityFramework/Elsa.Persistence.EntityFramework.Core/Extensions/ServiceCollectionExtensions.cs index 8a44a3c84..59c4c737c 100644 --- a/src/persistence/Elsa.Persistence.EntityFramework/Elsa.Persistence.EntityFramework.Core/Extensions/ServiceCollectionExtensions.cs +++ b/src/persistence/Elsa.Persistence.EntityFramework/Elsa.Persistence.EntityFramework.Core/Extensions/ServiceCollectionExtensions.cs @@ -93,20 +93,22 @@ namespace Elsa.Persistence.EntityFramework.Core.Extensions /// application, where re-use of DB Context objects is impractical. /// /// - /// Auto-running of migrations is not supported in this scenario. When pooling is not in use and each instance of + /// Although auto-running of migrations is supported in this scenario, use this with caution. When pooling is not in use and each instance of /// the DB Context may differ, it is not feasible to try to automatically migrate them. - /// Your application is responsible for executing the contents of the class in a manner + /// Your application is ultimately responsible for executing the contents of the class in a manner /// which is suitable for your use-case. /// /// /// An Elsa options builder /// A configuration builder callback /// The service lifetime which will be used for each DB Context instance + /// If true then database migrations will be auto-executed on startup /// The Elsa options builder, so calls may be chained public static ElsaOptionsBuilder UseNonPooledEntityFrameworkPersistence(this ElsaOptionsBuilder elsa, Action configure, - ServiceLifetime serviceLifetime = ServiceLifetime.Singleton) => - elsa.UseNonPooledEntityFrameworkPersistence(configure, serviceLifetime); + ServiceLifetime serviceLifetime = ServiceLifetime.Singleton, + bool autoRunMigrations = false) => + elsa.UseNonPooledEntityFrameworkPersistence(configure, serviceLifetime, autoRunMigrations); /// /// Configures Elsa to use Entity Framework Core for persistence, without using pooled DB Context instances. @@ -117,21 +119,23 @@ namespace Elsa.Persistence.EntityFramework.Core.Extensions /// application, where re-use of DB Context objects is impractical. /// /// - /// Auto-running of migrations is not supported in this scenario. When pooling is not in use and each instance of + /// Although auto-running of migrations is supported in this scenario, use this with caution. When pooling is not in use and each instance of /// the DB Context may differ, it is not feasible to try to automatically migrate them. - /// Your application is responsible for executing the contents of the class in a manner + /// Your application is ultimately responsible for executing the contents of the class in a manner /// which is suitable for your use-case. /// /// /// An Elsa options builder /// A configuration builder callback /// The service lifetime which will be used for each DB Context instance + /// If true then database migrations will be auto-executed on startup /// The concrete type of to use. /// The Elsa options builder, so calls may be chained public static ElsaOptionsBuilder UseNonPooledEntityFrameworkPersistence(this ElsaOptionsBuilder elsa, Action configure, - ServiceLifetime serviceLifetime = ServiceLifetime.Singleton) where TElsaContext : ElsaContext => - elsa.UseNonPooledEntityFrameworkPersistence((_, builder) => configure(builder), serviceLifetime); + ServiceLifetime serviceLifetime = ServiceLifetime.Singleton, + bool autoRunMigrations = false) where TElsaContext : ElsaContext => + elsa.UseNonPooledEntityFrameworkPersistence((_, builder) => configure(builder), serviceLifetime, autoRunMigrations); /// /// Configures Elsa to use Entity Framework Core for persistence, without using pooled DB Context instances. @@ -142,20 +146,22 @@ namespace Elsa.Persistence.EntityFramework.Core.Extensions /// application, where re-use of DB Context objects is impractical. /// /// - /// Auto-running of migrations is not supported in this scenario. When pooling is not in use and each instance of + /// Although auto-running of migrations is supported in this scenario, use this with caution. When pooling is not in use and each instance of /// the DB Context may differ, it is not feasible to try to automatically migrate them. - /// Your application is responsible for executing the contents of the class in a manner + /// Your application is ultimately responsible for executing the contents of the class in a manner /// which is suitable for your use-case. /// /// /// An Elsa options builder /// A configuration builder callback, which also provides access to a service provider /// The service lifetime which will be used for each DB Context instance + /// If true then database migrations will be auto-executed on startup /// The Elsa options builder, so calls may be chained public static ElsaOptionsBuilder UseNonPooledEntityFrameworkPersistence(this ElsaOptionsBuilder elsa, Action configure, - ServiceLifetime serviceLifetime = ServiceLifetime.Singleton) => - elsa.UseNonPooledEntityFrameworkPersistence(configure, serviceLifetime); + ServiceLifetime serviceLifetime = ServiceLifetime.Singleton, + bool autoRunMigrations = false) => + elsa.UseNonPooledEntityFrameworkPersistence(configure, serviceLifetime, autoRunMigrations); /// /// Configures Elsa to use Entity Framework Core for persistence, without using pooled DB Context instances. @@ -166,21 +172,23 @@ namespace Elsa.Persistence.EntityFramework.Core.Extensions /// application, where re-use of DB Context objects is impractical. /// /// - /// Auto-running of migrations is not supported in this scenario. When pooling is not in use and each instance of + /// Although auto-running of migrations is supported in this scenario, use this with caution. When pooling is not in use and each instance of /// the DB Context may differ, it is not feasible to try to automatically migrate them. - /// Your application is responsible for executing the contents of the class in a manner + /// Your application is ultimately responsible for executing the contents of the class in a manner /// which is suitable for your use-case. /// /// /// An Elsa options builder /// A configuration builder callback, which also provides access to a service provider /// The service lifetime which will be used for each DB Context instance + /// If true then database migrations will be auto-executed on startup /// The concrete type of to use. /// The Elsa options builder, so calls may be chained public static ElsaOptionsBuilder UseNonPooledEntityFrameworkPersistence(this ElsaOptionsBuilder elsa, Action configure, - ServiceLifetime serviceLifetime = ServiceLifetime.Singleton) where TElsaContext : ElsaContext => - UseEntityFrameworkPersistence(elsa, configure, false, false, serviceLifetime); + ServiceLifetime serviceLifetime = ServiceLifetime.Singleton, + bool autoRunMigrations = false) where TElsaContext : ElsaContext => + UseEntityFrameworkPersistence(elsa, configure, autoRunMigrations, false, serviceLifetime); static ElsaOptionsBuilder UseEntityFrameworkPersistence(ElsaOptionsBuilder elsa, Action configure,