示例#1
0
        private ActivityContext CreateActivityRuntimeContext(ActivityDefinition definition)
        {
            var propertyBag = (SagaPropertyBag)definition.Properties;
            IEnumerable <KeyValuePair <string, string> > properties = State.Properties;

            if (propertyBag != null)
            {
                properties = properties.Concat(propertyBag.ContextProperties);
            }

            return(new ActivityContext(
                       this.GetPrimaryKey(),
                       GrainFactory,
                       grainContext,
                       properties.ToDictionary(x => x.Key, y => y.Value)
                       ));
        }
示例#2
0
        private IActivity GetActivity(ActivityDefinition definition)
        {
            var activity = (IActivity)serviceProvider.GetService(definition.Type);

            var hasConfig = definition.GetType().GetProperties().Any(x => x.Name == nameof(Activity <object> .Config));

            if (!hasConfig)
            {
                return(activity);
            }

            var prop  = activity.GetType().GetProperty(nameof(Activity <object> .Config));
            var value = definition.GetType().GetProperty(nameof(ActivityDefinition <object> .Config)).GetValue(definition);

            prop.SetValue(activity, value);

            return(activity);
        }
示例#3
0
 private IActivity GetActivity(ActivityDefinition definition)
 {
     return((IActivity)serviceProvider.GetService(definition.Type));
 }