public void Execute(IServiceProvider serviceProvider)
        {
            using (var crmSericeProvider = new CdsServiceProvider(serviceProvider))
            {
                var commandsFactory    = new CdsCommandFactory(crmSericeProvider, this.CdsUnitOfWorkRepository);
                var registeredCommands = new List <ICdsCommand>();

                RegisterCommands(commandsFactory, registeredCommands);

                foreach (ICdsCommand command in registeredCommands)
                {
                    var commandName = command.GetType().Name.ToString();

                    if (command.CanExecute())
                    {
                        crmSericeProvider.TracingService.Trace($"{commandName} - execution started");
                        command.Execute();
                        crmSericeProvider.TracingService.Trace($"{commandName} - execution completed");
                    }
                }
            }
        }
Beispiel #2
0
 public override void RegisterCommands(CdsCommandFactory commandFactory, List <ICdsCommand> registeredActions)
 {
     registeredActions.Add(commandFactory.GetCommand <TryCreateTaskCommand>());
 }
 public abstract void RegisterCommands(CdsCommandFactory commandsFactory, List <ICdsCommand> registeredCommands);