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));
        }
Ejemplo n.º 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);
        }