예제 #1
0
    /// <summary>
    /// Constructor with an options builder action.
    /// </summary>
    /// <param name="builderAction">An action to configure transitions</param>
    protected WorkflowAbstract(Action <WorkflowOptionsBuilder <TState, TCommand> > builderAction)
    {
        var builder = new WorkflowOptionsBuilder <TState, TCommand>();

        builderAction(builder);
        _transitions = builder.Build();
    }
예제 #2
0
        public static WorkflowOptionsBuilder UseRedis(this WorkflowOptionsBuilder workflowConfiguration,
                                                      IServiceCollection services, Action <RedisConfigModel> options)
        {
            options?.Invoke(ConfigModel);

            ConfigureDependencyInjection(services);

            return(workflowConfiguration);
        }
예제 #3
0
        public static WorkflowOptionsBuilder UseSqlServer(this WorkflowOptionsBuilder workflowConfiguration,
                                                          IServiceCollection services, Action <SqlServerConfigModel> options)
        {
            options?.Invoke(ConfigModel);

            ConfigureDependencyInjection(services);

            services.AddScoped <WorkflowDbContext>();
            services.AddDbContext <WorkflowDbContext>(optionsBuilder =>
            {
                optionsBuilder.UseSqlServer(ConfigModel.ConnectionString);
                if (ConfigModel.LoggerFactory != null)
                {
                    optionsBuilder.UseLoggerFactory(ConfigModel.LoggerFactory);
                }
                optionsBuilder.UseApplicationServiceProvider(services.BuildServiceProvider());
            });

            return(workflowConfiguration);
        }