Пример #1
0
        private void DefineRepositoryCommands(IStageConfig <Repository> stage)
        {
            var getCommand = new CommandDefinition <Repository, IRepoIdCommand>(
                (s, arg) =>
            {
                arg.Payload.ReturnedItem = s.GetValue(arg.Payload.Id, arg.Payload.EntityType);
                return(arg.Payload.ReturnedItem == null ? PipelineAction.Stop : PipelineAction.Continue);
            });

            var saveCommand = new CommandDefinition <Repository, IRepoEntityCommand>(
                (s, arg) => {
                s.Save(arg.Payload.Entity);
            });

            var deleteCommand = new CommandDefinition <Repository, IRepoEntityCommand>(
                (s, arg) =>
            {
                s.Delete(arg.Payload.Entity);
            });

            stage.CommandConfig
            .WithCommand(Commands.Get, getCommand)
            .WithCommand(Commands.Save, saveCommand)
            .WithCommand(Commands.Delete, deleteCommand);
        }
Пример #2
0
 public LevelRunRequest(int phase, Action?callback, LevelRunMethod runMethod, IStageConfig stageConf)
 {
     toPhase = phase;
     cb      = callback;
     method  = runMethod;
     stage   = stageConf;
 }
Пример #3
0
        public void AddStage <TStage>(IStageConfig <TStage> stageConfig)
        {
            var name = stageConfig.Name;

            if (_stages.Any(x => string.CompareOrdinal(x.Name, name) == 0))
            {
                throw new ArgumentException(string.Format("There is already another configured Stage with name {0}", name));
            }
            _stages.Add(stageConfig);
        }
Пример #4
0
        public PipelineStage(IStageConfig <TStage> stageConfig, TStage stage)
        {
            Stage   = stage;
            _config = stageConfig;

            _startCommand = new Lazy <IStageSessionCommand>(() => CreateStageSessionCommand(_config.CommandConfig.GetStartSessionCommand()), false);
            _abortCommand = new Lazy <IStageSessionCommand>(() => CreateStageSessionCommand(_config.CommandConfig.GetAbortSessionCommand()), false);
            _endCommand   = new Lazy <IStageSessionCommand>(() => CreateStageSessionCommand(_config.CommandConfig.GetEndSessionCommand()), false);
            _commandCache = new Dictionary <string, List <IStageCommand> >();
        }
Пример #5
0
        private void DefineSimpleLoggerCommands(IStageConfig <SimpleLogger> stage)
        {
            var idCommand = new CommandDefinition <SimpleLogger, IRepoIdCommand>(
                (s, arg) => s.Debug($"Command: {arg.CommandName}, Args: {arg.Payload.Id}, Item: {arg.Payload.ReturnedItem}"),
                (s, arg) => s.Debug($"PostCommand: {arg.CommandName}, Args: {arg.Payload.Id}, Item: {arg.Payload.ReturnedItem}"));

            var entityCommand = new CommandDefinition <SimpleLogger, IRepoEntityCommand>(
                (s, arg) => s.Debug($"Command: {arg.CommandName}, Args: {arg.Payload.Entity.Id}"),
                (s, arg) => s.Debug($"PostCommand: {arg.CommandName}, Args: {arg.Payload.Entity.Id}"));

            var specialCommand = new CommandDefinition <SimpleLogger, IRepoEntityCommand>(
                (s, arg) => s.Debug($"Special Command: {arg.CommandName}, Args: {arg.Payload.Entity.Id}"),
                (s, arg) => s.Debug($"Special PostCommand: {arg.CommandName}, Args: {arg.Payload.Entity.Id}"));

            // command name of null implies it will be executed by default for all commands (where no specific command is defined)
            stage.CommandConfig
            .WithCommand(null, idCommand)
            .WithCommand(null, entityCommand)
            .WithCommand(Commands.Special, specialCommand);
        }
Пример #6
0
 public ConfigWithExecutionDate(IStageConfig <IProjectSetting> stageConfig)
     : base(stageConfig)
 {
 }
Пример #7
0
 protected StageConfigDecorator(IStageConfig <IProjectSetting> stageConfig)
 {
     _stageConfig = stageConfig;
 }