public IActivityRegistrationConfigurator <TActivity, TArguments, TLog> AddActivity <TActivity, TArguments, TLog>(Type activityDefinitionType,
                                                                                                                         Action <IExecuteActivityConfigurator <TActivity, TArguments> > configureExecute = null,
                                                                                                                         Action <ICompensateActivityConfigurator <TActivity, TLog> > configureCompensate = null)
            where TActivity : class, IActivity <TArguments, TLog>
            where TArguments : class
            where TLog : class
        {
            IActivityRegistration ValueFactory(Type type)
            {
                ActivityRegistrationCache.Register(type, Registrar);

                return(new ActivityRegistration <TActivity, TArguments, TLog>());
            }

            var registration = _activities.GetOrAdd(typeof(TActivity), ValueFactory);

            registration.AddConfigureAction(configureExecute);
            registration.AddConfigureAction(configureCompensate);

            if (activityDefinitionType != null)
            {
                ActivityDefinitionRegistrationCache.Register(activityDefinitionType, Registrar);
            }

            return(new ActivityRegistrationConfigurator <TActivity, TArguments, TLog>(this));
        }
示例#2
0
        void IRegistrationConfigurator.AddActivity <TActivity, TArguments, TLog>(Action <IExecuteActivityConfigurator <TActivity, TArguments> > configureExecute,
                                                                                 Action <ICompensateActivityConfigurator <TActivity, TLog> > configureCompensate)
        {
            IActivityRegistration ValueFactory(Type type)
            {
                ActivityRegistrationCache.Register(type, _containerRegistrar);

                return(new ActivityRegistration <TActivity, TArguments, TLog>());
            }

            var registration = _activityRegistrations.GetOrAdd(typeof(TActivity), ValueFactory);

            registration.AddConfigureAction(configureExecute);
            registration.AddConfigureAction(configureCompensate);
        }
 public void AddActivity(Type activityType, Type activityDefinitionType)
 {
     _activities.GetOrAdd(activityType,
                          type => ActivityRegistrationCache.CreateRegistration(type, activityDefinitionType, Registrar));
 }
 public IActivityRegistrationConfigurator AddActivity(Type activityType, Type activityDefinitionType)
 {
     return(ActivityRegistrationCache.AddActivity(this, activityType, activityDefinitionType));
 }