Beispiel #1
0
        private static void AddCore <TDbContext>(ElsaOptionsBuilder elsa) where TDbContext : ElsaMongoDbContext
        {
            elsa.Services
            .AddSingleton <MongoDbWorkflowDefinitionStore>()
            .AddSingleton <MongoDbWorkflowInstanceStore>()
            .AddSingleton <MongoDbWorkflowExecutionLogStore>()
            .AddSingleton <MongoDbBookmarkStore>()
            .AddSingleton <MongoDbTriggerStore>()
            .AddSingleton <TDbContext>()
            .AddSingleton <ElsaMongoDbContext, TDbContext>()
            .AddSingleton(sp => sp.GetRequiredService <TDbContext>().WorkflowDefinitions)
            .AddSingleton(sp => sp.GetRequiredService <TDbContext>().WorkflowInstances)
            .AddSingleton(sp => sp.GetRequiredService <TDbContext>().WorkflowExecutionLog)
            .AddSingleton(sp => sp.GetRequiredService <TDbContext>().Bookmarks)
            .AddSingleton(sp => sp.GetRequiredService <TDbContext>().Triggers)
            .AddStartupTask <DatabaseInitializer>();

            elsa
            .UseWorkflowDefinitionStore(sp => sp.GetRequiredService <MongoDbWorkflowDefinitionStore>())
            .UseWorkflowInstanceStore(sp => sp.GetRequiredService <MongoDbWorkflowInstanceStore>())
            .UseWorkflowExecutionLogStore(sp => sp.GetRequiredService <MongoDbWorkflowExecutionLogStore>())
            .UseBookmarkStore(sp => sp.GetRequiredService <MongoDbBookmarkStore>())
            .UseTriggerStore(sp => sp.GetRequiredService <MongoDbTriggerStore>());

            DatabaseRegister.RegisterMapsAndSerializers();
        }
Beispiel #2
0
        private static void AddCore <TDbContext>(WorkflowSettingsOptionsBuilder workflowSettingsOptions) where TDbContext : ElsaMongoDbContext
        {
            workflowSettingsOptions.Services
            .AddSingleton <MongoDbWorkflowSettingsStore>()
            .AddSingleton <TDbContext>()
            .AddSingleton <ElsaMongoDbContext, TDbContext>()
            .AddSingleton(sp => sp.GetRequiredService <TDbContext>().WorkflowSettings)
            .AddStartupTask <DatabaseInitializer>();

            workflowSettingsOptions.UseWorkflowSettingsStore(sp => sp.GetRequiredService <MongoDbWorkflowSettingsStore>());

            DatabaseRegister.RegisterMapsAndSerializers();
        }