/// <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(); }
public static WorkflowOptionsBuilder UseRedis(this WorkflowOptionsBuilder workflowConfiguration, IServiceCollection services, Action <RedisConfigModel> options) { options?.Invoke(ConfigModel); ConfigureDependencyInjection(services); return(workflowConfiguration); }
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); }