Prevent custom composite activities from overriding values specified by the activity definition
This particularly fixes the issue where a composite activity can potentially specify its own activity ID, which would break the workflow since the activity definition ID (as generated by the designer) would be different.
This commit is contained in:
parent
9b1e4616d0
commit
7479ff1210
|
|
@ -155,19 +155,19 @@ namespace Elsa.Services.Workflows
|
|||
else if (typeof(CompositeActivity).IsAssignableFrom(activityType.Type))
|
||||
{
|
||||
var compositeActivity = (CompositeActivity) ActivatorUtilities.CreateInstance(_serviceProvider, activityType.Type);
|
||||
var compositeActivityBuilder = new CompositeActivityBuilder(_serviceProvider, _startingActivitiesProvider, activityType.Type, activityType.TypeName)
|
||||
{
|
||||
ActivityId = activityDefinition.ActivityId,
|
||||
Name = activityDefinition.Name,
|
||||
DisplayName = activityDefinition.DisplayName,
|
||||
Description = activityDefinition.Description,
|
||||
PersistWorkflowEnabled = activityDefinition.PersistWorkflow,
|
||||
LoadWorkflowContextEnabled = activityDefinition.LoadWorkflowContext,
|
||||
SaveWorkflowContextEnabled = activityDefinition.SaveWorkflowContext,
|
||||
PropertyStorageProviders = activityDefinition.PropertyStorageProviders
|
||||
};
|
||||
var compositeActivityBuilder = new CompositeActivityBuilder(_serviceProvider, _startingActivitiesProvider, activityType.Type, activityType.TypeName);
|
||||
|
||||
compositeActivity.Build(compositeActivityBuilder);
|
||||
|
||||
// Ensure the composite activity is assigned the same properties as the activity definition referencing this activity.
|
||||
compositeActivityBuilder.ActivityId = activityDefinition.ActivityId;
|
||||
compositeActivityBuilder.Name = activityDefinition.Name;
|
||||
compositeActivityBuilder.DisplayName = activityDefinition.DisplayName;
|
||||
compositeActivityBuilder.Description = activityDefinition.Description;
|
||||
compositeActivityBuilder.PersistWorkflowEnabled = activityDefinition.PersistWorkflow;
|
||||
compositeActivityBuilder.LoadWorkflowContextEnabled = activityDefinition.LoadWorkflowContext;
|
||||
compositeActivityBuilder.SaveWorkflowContextEnabled = activityDefinition.SaveWorkflowContext;
|
||||
compositeActivityBuilder.PropertyStorageProviders = activityDefinition.PropertyStorageProviders;
|
||||
|
||||
var compositeActivityBlueprint = compositeActivityBuilder.Build($"{activityDefinition.ActivityId}:activity");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue