示例#1
0
        private async Task <ActivityPropertyProviders> CreatePropertyProviders(ICompositeActivityDefinition compositeActivityDefinition, CancellationToken cancellationToken)
        {
            var propertyProviders   = new ActivityPropertyProviders();
            var activityDefinitions = compositeActivityDefinition.Activities;

            foreach (var activityDefinition in activityDefinitions)
            {
                var activityType = await _activityTypeService.GetActivityTypeAsync(activityDefinition.Type, cancellationToken);

                var activityDescriptor = await activityType.DescribeAsync();

                var propertyDescriptors = activityDescriptor.InputProperties;

                foreach (var property in activityDefinition.Properties)
                {
                    var propertyDescriptor = propertyDescriptors.FirstOrDefault(x => x.Name == property.Name);

                    if (propertyDescriptor == null)
                    {
                        _logger.LogWarning("Could not find the specified property '{PropertyName}' for activity type {ActivityTypeName}", property.Name, activityType.TypeName);
                        continue;
                    }

                    var syntax     = property.Syntax ?? propertyDescriptor.DefaultSyntax ?? SyntaxNames.Literal;
                    var expression = property.GetExpression(syntax);
                    var provider   = new ExpressionActivityPropertyValueProvider(expression, syntax, propertyDescriptor.Type);
                    propertyProviders.AddProvider(activityDefinition.ActivityId, property.Name, provider);
                }
            }

            return(propertyProviders);
        }
 public CompositeActivityBlueprint(
     string id,
     ICompositeActivityBlueprint?parent,
     string?name,
     string?displayName,
     string?description,
     string type,
     bool persistWorkflow,
     bool loadWorkflowContext,
     bool saveWorkflowContext,
     IDictionary <string, string> propertyStorageProviders,
     string?source) : base(id, parent, name, displayName, description, type, persistWorkflow, loadWorkflowContext, saveWorkflowContext, propertyStorageProviders, source)
 {
     Activities  = new List <IActivityBlueprint>();
     Connections = new List <IConnection>();
     ActivityPropertyProviders = new ActivityPropertyProviders();
 }
示例#3
0
 public CompositeActivityBlueprint()
 {
     Activities  = new List <IActivityBlueprint>();
     Connections = new List <IConnection>();
     ActivityPropertyProviders = new ActivityPropertyProviders();
 }
示例#4
0
 public WorkflowBlueprint()
 {
     ActivityPropertyProviders = new ActivityPropertyProviders();
     Variables        = new Variables();
     CustomAttributes = new Variables();
 }