Пример #1
0
 public static WorkflowOptions UseOracle(this WorkflowOptions options,
                                         string connectionString, bool canCreateDB, bool canMigrateDB)
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new OracleContextFactory(connectionString, sp.GetService <ILoggerFactory>()), canCreateDB, canMigrateDB));
     options.Services.AddTransient <IWorkflowPurger>(sp => new WorkflowPurger(new OracleContextFactory(connectionString, sp.GetService <ILoggerFactory>())));
     return(options);
 }
Пример #2
0
 public static WorkflowOptions UseCosmosDbPersistence(this WorkflowOptions options, string connectionString, string databaseId)
 {
     options.Services.AddSingleton <ICosmosClientFactory>(sp => new CosmosClientFactory(connectionString));
     options.Services.AddTransient <ICosmosDbProvisioner>(sp => new CosmosDbProvisioner(sp.GetService <ICosmosClientFactory>(), sp.GetService <ILoggerFactory>()));
     options.UsePersistence(sp => new CosmosDbPersistenceProvider(sp.GetService <ICosmosClientFactory>(), databaseId, sp.GetService <ICosmosDbProvisioner>()));
     return(options);
 }
 public static WorkflowOptions UsePostgreSQL(this WorkflowOptions options,
                                             string connectionString, bool canCreateDB, bool canMigrateDB, string schemaName = "wfc")
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new PostgresContextFactory(connectionString, schemaName), canCreateDB, canMigrateDB));
     options.Services.AddTransient <IWorkflowPurger>(sp => new WorkflowPurger(new PostgresContextFactory(connectionString, schemaName)));
     return(options);
 }
        public static WorkflowOptions UseMongoDB(
            this WorkflowOptions options,
            Func <IServiceProvider, IMongoDatabase> createDatabase)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (createDatabase == null)
            {
                throw new ArgumentNullException(nameof(createDatabase));
            }

            options.UsePersistence(sp =>
            {
                var db = createDatabase(sp);
                return(new MongoPersistenceProvider(db));
            });
            options.Services.AddTransient <IWorkflowPurger>(sp =>
            {
                var db = createDatabase(sp);
                return(new WorkflowPurger(db));
            });

            return(options);
        }
 public static WorkflowOptions UseMongoDB(this WorkflowOptions options, string mongoUrl, string databaseName)
 {
     options.UsePersistence(sp =>
     {
         var client = new MongoClient(mongoUrl);
         var db     = client.GetDatabase(databaseName);
         return(new WorkflowPersistenceProvider(db));
     });
     return(options);
 }
        public static WorkflowOptions UseCosmosDbPersistence(
            this WorkflowOptions options,
            string connectionString,
            string databaseId,
            CosmosDbStorageOptions cosmosDbStorageOptions = null)
        {
            if (cosmosDbStorageOptions == null)
            {
                cosmosDbStorageOptions = new CosmosDbStorageOptions();
            }

            options.Services.AddSingleton <ICosmosClientFactory>(sp => new CosmosClientFactory(connectionString));
            options.Services.AddTransient <ICosmosDbProvisioner>(sp => new CosmosDbProvisioner(sp.GetService <ICosmosClientFactory>(), cosmosDbStorageOptions));
            options.UsePersistence(sp => new CosmosDbPersistenceProvider(sp.GetService <ICosmosClientFactory>(), databaseId, sp.GetService <ICosmosDbProvisioner>(), cosmosDbStorageOptions));
            return(options);
        }
        public static WorkflowOptions UseRavenDB(this WorkflowOptions options, RavenStoreOptions configOptions)
        {
            IDocumentStore store = new DocumentStore
            {
                Urls        = new[] { configOptions.ServerUrl },
                Database    = configOptions.DatabaseName,
                Certificate = new X509Certificate2(configOptions.CertificatePath, configOptions.CertificatePassword)
            }.Initialize();

            options.UsePersistence(sp =>
            {
                return(new RavendbPersistenceProvider(store));
            });

            options.Services.AddTransient <IWorkflowPurger>(sp =>
            {
                return(new WorkflowPurger(store));
            });

            return(options);
        }
 public static WorkflowOptions UseMongoDB(
     this WorkflowOptions options,
     string mongoUrl,
     string databaseName,
     Action <MongoClientSettings> configureClient = default)
 {
     options.UsePersistence(sp =>
     {
         var mongoClientSettings = MongoClientSettings.FromConnectionString(mongoUrl);
         configureClient?.Invoke(mongoClientSettings);
         var client = new MongoClient(mongoClientSettings);
         var db     = client.GetDatabase(databaseName);
         return(new MongoPersistenceProvider(db));
     });
     options.Services.AddTransient <IWorkflowPurger>(sp =>
     {
         var mongoClientSettings = MongoClientSettings.FromConnectionString(mongoUrl);
         configureClient?.Invoke(mongoClientSettings);
         var client = new MongoClient(mongoClientSettings);
         var db     = client.GetDatabase(databaseName);
         return(new WorkflowPurger(db));
     });
     return(options);
 }
Пример #9
0
 public static WorkflowOptions UseAwsDynamoPersistence(this WorkflowOptions options, AWSCredentials credentials, AmazonDynamoDBConfig config, string tablePrefix)
 {
     options.Services.AddTransient <IDynamoDbProvisioner>(sp => new DynamoDbProvisioner(credentials, config, tablePrefix, sp.GetService <ILoggerFactory>()));
     options.UsePersistence(sp => new DynamoPersistenceProvider(credentials, config, sp.GetService <IDynamoDbProvisioner>(), tablePrefix, sp.GetService <ILoggerFactory>()));
     return(options);
 }
 public static WorkflowOptions UseSqlServer(this WorkflowOptions options, string connectionString, bool canCreateDB, bool canMigrateDB, Action <DbConnection> initAction = null)
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new SqlContextFactory(connectionString, initAction), canCreateDB, canMigrateDB));
     options.Services.AddTransient <IWorkflowPurger>(sp => new WorkflowPurger(new SqlContextFactory(connectionString, initAction)));
     return(options);
 }
Пример #11
0
 public static WorkflowOptions UsePostgreSQL(this WorkflowOptions options, string connectionString, bool canCreateDB, bool canMigrateDB)
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new PostgresContextFactory(connectionString), canCreateDB, canMigrateDB));
     return(options);
 }
Пример #12
0
 public static WorkflowOptions UsePostgreSQL(this WorkflowOptions options, string connectionString, bool canCreateDB, bool canMigrateDB)
 {
     options.UsePersistence(sp => new PostgresPersistenceProvider(connectionString, canCreateDB, canMigrateDB));
     return(options);
 }
Пример #13
0
 public static WorkflowOptions UseMySQL(this WorkflowOptions options, string connectionString, bool canCreateDB, Action <MySqlDbContextOptionsBuilder> mysqlOptionsAction = null)
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new MysqlContextFactory(connectionString, mysqlOptionsAction), canCreateDB, false));
     return(options);
 }
 public static WorkflowOptions UseSqlite(this WorkflowOptions options, string connectionString, bool canCreateDB)
 {
     options.UsePersistence(sp => new SqlitePersistenceProvider(connectionString, canCreateDB));
     return(options);
 }
Пример #15
0
 public static WorkflowOptions UseSqlite(this WorkflowOptions options, string connectionString, bool canCreateDB)
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new SqliteContextFactory(connectionString), canCreateDB, false));
     options.Services.AddTransient <IWorkflowPurger>(sp => new WorkflowPurger(new SqliteContextFactory(connectionString)));
     return(options);
 }
Пример #16
0
 public static WorkflowOptions UseOracle(this WorkflowOptions options, string connectionString, bool canCreateDB, bool canMigrateDB, Action <OracleDbContextOptionsBuilder> oracleOptionsAction = null)
 {
     options.UsePersistence(sp => new EntityFrameworkPersistenceProvider(new OracleContextFactory(connectionString, oracleOptionsAction), canCreateDB, canMigrateDB));
     options.Services.AddTransient <IWorkflowPurger>(sp => new WorkflowPurger(new OracleContextFactory(connectionString, oracleOptionsAction)));
     return(options);
 }
 public static WorkflowOptions UseRedisPersistence(this WorkflowOptions options, string connectionString, string prefix, bool deleteComplete = false)
 {
     options.UsePersistence(sp => new RedisPersistenceProvider(connectionString, prefix, deleteComplete, sp.GetService <ILoggerFactory>()));
     return(options);
 }
 public static WorkflowOptions UseMySQL(this WorkflowOptions options, string connectionString, bool canCreateDB = true, bool canMigrateDB = true, Action <MySqlDbContextOptionsBuilder> mysqlOptionsAction = null)
 {
     options.UsePersistence(sp => new MyEntityFrameworkPersistenceProvider(new TestContextFactory(connectionString, mysqlOptionsAction), canCreateDB, canMigrateDB));
     options.Services.AddTransient <IWorkflowPurger>(sp => new WorkflowPurger(new TestContextFactory(connectionString, mysqlOptionsAction)));
     return(options);
 }