private IEnumerable <IStepPropertyValueProvider> AllValueProviders(StepSchema stepSchema)
        {
            yield return(new StepSchemaValueProvider(stepSchema));

            foreach (var provider in _stepPropertyValueProviders)
            {
                yield return(provider);
            }
        }
Exemple #2
0
        public IStepBuilder AddStep <T>(Action <UniqueStepId> callback)
        {
            _counter++;
            var uniqueId   = new UniqueStepId(_counter.ToString(), Id, _parent.Id, _parent.Parent.SchemaName, _parent.Parent.SchemaName);
            var stepSchema = new StepSchema()
            {
                Name           = _counter.ToString(),
                Implementation = typeof(T).AssemblyQualifiedName
            };

            Steps.Add(stepSchema);
            callback(uniqueId);
            return(new StepBuilder(this, stepSchema));
        }
        private BaseStep CreateStepInstance(StepSchema stepSchema, UniqueStepId stepId)
        {
            var stepType     = Type.GetType(stepSchema.Implementation, true);
            var stepInstance = _stepFactory.CreateInstance(stepType, stepId);

            foreach (var publicProperty in stepType.GetProperties())
            {
                object value = null;
                if (AllValueProviders(stepSchema).Any(x => x.TryProvideValue(publicProperty.Name, out value)))
                {
                    publicProperty.SetValue(stepInstance, value);
                }
            }

            return(stepInstance);
        }
 public StepBuilder(ActivityBuilder activityBuilder, StepSchema stepSchema)
 {
     _parent     = activityBuilder;
     _stepSchema = stepSchema;
 }
        private BaseStep BuildStep(UniqueActivityId activityId, StepSchema stepSchema)
        {
            var stepId = activityId.MakeStepId(stepSchema.Name);

            return(CreateStepInstance(stepSchema, stepId));
        }
 public StepSchemaValueProvider(StepSchema schema)
 {
     _schema = schema;
 }