DynamicActivity Class
.NET Framework 4.5
Provides an object model that allows you to construct activities dynamically that interface with the WF designer and runtime using ICustomTypeDescriptor.
Namespace: System.Activities
Assembly: System.Activities (in System.Activities.dll)
The DynamicActivity type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Attributes | Gets the collection of attributes of the dynamically generated activity. |
![]() | CacheId | Gets the identifier of the cache that is unique within the scope of the workflow definition. (Inherited from Activity.) |
![]() | Constraints | Returns a collection of Constraint activities that are configured to provide validation for the DynamicActivity. |
![]() | DisplayName | Gets or sets an optional friendly name that is used for debugging, validation, exception handling, and tracking. (Inherited from Activity.) |
![]() | Id | Gets an identifier that is unique in the scope of the workflow definition. (Inherited from Activity.) |
![]() | Implementation | Gets or sets the execution logic of the activity. |
![]() | ImplementationVersion | Gets or sets the implementation version of the activity. |
![]() | Name | The name to be displayed for the activity in the workflow designer. |
![]() | Properties | Gets the collection of properties that map to the arguments of the dynamically generated activity. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | ShouldSerializeDisplayName | Indicates whether the DisplayName property should be serialized. (Inherited from Activity.) |
![]() | ToString | Returns a String that contains the Id and DisplayName of the Activity. (Inherited from Activity.) |
| Name | Description | |
|---|---|---|
![]() ![]() | ICustomTypeDescriptor.GetAttributes | Returns a collection of attributes of the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetClassName | Returns the class name of the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetComponentName | Returns the component name of the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetConverter | Returns a type converter for the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetDefaultEvent | Returns the default event for the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetDefaultProperty | Returns the default property for the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetEditor | Returns an editor with the specified base type. |
![]() ![]() | ICustomTypeDescriptor.GetEvents() | Returns the collection of events of the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetEvents(Attribute[]) | Returns the collection of events of the dynamic activity using a specified array of attributes as a filter. |
![]() ![]() | ICustomTypeDescriptor.GetProperties() | Returns the collection of properties of the dynamic activity. |
![]() ![]() | ICustomTypeDescriptor.GetProperties(Attribute[]) | Returns the collection of properties of the dynamic activity using a specified array of attributes as a filter. |
![]() ![]() | ICustomTypeDescriptor.GetPropertyOwner | Returns this instance of the DynamicActivity class. |
The following example shows how to create a DynamicActivity.
// Variables var iterationVariable = new DelegateInArgument<int>() { Name = "iterationVariable" }; var accumulator = new Variable<int>() { Default = 0, Name = "accumulator" }; // Define the Input and Output arguments that the DynamicActivity binds to var numbers = new InArgument<List<int>>(); var average = new OutArgument<double>(); var result = new Variable<double>() { Name = "result" }; return new DynamicActivity() { DisplayName = "Find average", Properties = { // Input argument new DynamicActivityProperty { Name = "Numbers", Type = typeof(InArgument<List<int>>), Value = numbers }, // Output argument new DynamicActivityProperty { Name = "Average", Type = typeof(OutArgument<double>), Value = average } }, Implementation = () => new Sequence { Variables = { result, accumulator }, Activities = { new ForEach<int> { Values = new ArgumentValue<IEnumerable<int>> { ArgumentName = "Numbers" }, Body = new ActivityAction<int> { Argument = iterationVariable, Handler = new Assign<int> { To = accumulator, Value = new InArgument<int>(env => iterationVariable.Get(env) + accumulator.Get(env)) } } }, // Calculate the average and assign to the output argument. new Assign<double> { To = new ArgumentReference<double> { ArgumentName = "Average" }, Value = new InArgument<double>(env => accumulator.Get(env) / numbers.Get(env).Count<int>()) }, } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
