# Class DynamicParameter OptimaJet.Workflow.Core.Model.DynamicParameter Represents dynamically structured process parameter data as named properties that can be accessed by string key or through dynamic member binding. Namespace: [OptimaJet.Workflow.Core.Model](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/) ```csharp [JsonConverter(typeof(NewtonsoftDynamicParameterConverter))] [JsonConverter(typeof(SystemTextDynamicParameterConverter))] public sealed class DynamicParameter : DynamicObject, IDynamicMetaObjectProvider ``` ## Type Hierarchy - [DynamicObject](https://learn.microsoft.com/dotnet/api/system.dynamic.dynamicobject) - DynamicParameter Current type - Implemented interfaces - [IDynamicMetaObjectProvider](https://learn.microsoft.com/dotnet/api/system.dynamic.idynamicmetaobjectprovider) ## Attributes - `Newtonsoft.Json.JsonConverterAttribute`: Attribute of type Newtonsoft.Json.JsonConverterAttribute - `System.Text.Json.Serialization.JsonConverterAttribute`: Attribute of type System.Text.Json.Serialization.JsonConverterAttribute ## Constructors `public DynamicParameter()` Initializes an empty [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) with case-sensitive property-name comparisons. `public DynamicParameter(Dictionary properties)` Initializes a [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) that uses the supplied properties as its backing storage. ### Parameters | Name | Type | Description | | --- | --- | --- | | `properties` | `Dictionary` | The properties to store directly. The key comparer of the supplied [Dictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2) controls property-name comparisons. Use [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to create an empty instance with case-sensitive comparisons. | ## Properties `public IReadOnlyDictionary Dictionary { get; }` Gets a read-only view of the stored properties. `public object this[string propertyName] { get; set; }` Gets or sets the value at a specified property path. ### Exceptions | Type | Description | | --- | --- | | `Exception` | When setting a value, an intermediate path segment exists but cannot be represented as a [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). | ## Methods `public override bool TryGetMember(GetMemberBinder binder, out object result)` Gets a dynamic member value through [DynamicParameter.GetProperty(string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `binder` | `GetMemberBinder` | The [GetMemberBinder](https://learn.microsoft.com/dotnet/api/system.dynamic.getmemberbinder) that provides the member name. | | `result` | `Object` | When this method returns, contains the stored value, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the property does not exist. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) because the dynamic get operation is always handled. | `public override bool TrySetMember(SetMemberBinder binder, object value)` Sets a dynamic member value through [DynamicParameter.SetProperty(string, object)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `binder` | `SetMemberBinder` | The [SetMemberBinder](https://learn.microsoft.com/dotnet/api/system.dynamic.setmemberbinder) that provides the member name. | | `value` | `Object` | The value to store. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) because the dynamic set operation is always handled. | `public object GetProperty(string propertyName)` Gets the value at a specified property path. ### Parameters | Name | Type | Description | | --- | --- | --- | | `propertyName` | `String` | The property name or period-delimited path. | ### Returns | Type | Description | | --- | --- | | `Object` | The stored value, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the path does not exist or cannot be traversed. | ### Example After calling `parameter.SetProperty("Order.Customer.Name", "Alice")`, `parameter.GetProperty("Order.Customer.Name")` returns `"Alice"`, while `parameter.GetProperty("Order.Customer.Id")` returns [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). `public void SetProperty(string propertyName, object value)` Sets the value at a specified property path, creating missing nested [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) instances. ### Parameters | Name | Type | Description | | --- | --- | --- | | `propertyName` | `String` | The property name or period-delimited path. | | `value` | `Object` | The value to store. | ### Exceptions | Type | Description | | --- | --- | | `Exception` | An intermediate path segment exists but cannot be represented as a [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). | ### Example `parameter.SetProperty("Order.Customer.Name", "Alice")` creates the missing `Order` and `Customer` objects and stores `"Alice"` at the specified path. A subsequent call to `parameter.GetProperty("Order.Customer.Name")` returns `"Alice"`. `public bool HasProperty(string propertyName, bool ifNullThenNotExists = false)` Determines whether a specified property path exists. ### Parameters | Name | Type | Description | | --- | --- | --- | | `propertyName` | `String` | The property name or period-delimited path. | | `ifNullThenNotExists` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to treat a property whose value is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) as missing; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the path exists and satisfies the `ifNullThenNotExists` condition; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public DynamicParameter DeepClone()` Creates an independent copy of this [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) through JSON serialization. ### Returns | Type | Description | | --- | --- | | `DynamicParameter` | A new [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) containing the serialized property values. | `public string SerializeToJson()` Serializes the stored properties to JSON. ### Returns | Type | Description | | --- | --- | | `String` | The JSON representation of the stored properties. | `public static object ParseJson(string json)` Parses JSON text into the runtime representation used by [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `json` | `String` | The JSON text to parse. | ### Returns | Type | Description | | --- | --- | | `Object` | A scalar or collection value for a corresponding JSON value; a [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) for a JSON object; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for empty input or a JSON null value; or the original text if it is not valid JSON. | `public static object ParseJson(JToken jToken)` Converts a JToken into the runtime representation used by [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `jToken` | `JToken` | The JSON token to convert. | ### Returns | Type | Description | | --- | --- | | `Object` | A scalar or collection value for a corresponding JSON value; a [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) for a JSON object; or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if `jToken` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or represents a JSON null value. | `public static dynamic New()` Creates an empty [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) exposed through dynamic binding. ### Returns | Type | Description | | --- | --- | | `dynamic` | A new empty [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) returned as [dynamic](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/reference-types). | `public static object ConvertFrom(object value)` Converts an object graph to the representation used by [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `value` | `Object` | The value to convert. | ### Returns | Type | Description | | --- | --- | | `Object` | The converted scalar, collection, or [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) value; or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when `value` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | ### Exceptions | Type | Description | | --- | --- | | `Exception` | The object graph cannot be converted or exceeds the supported conversion depth. | ### Remarks A value that implements [IDynamicParameterCompatible](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/) supplies its properties through [IDynamicParameterCompatible.GetPropertiesAsDictionary()](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/). `public T ConvertTo() where T : IDynamicParameterCompatible, new()` Creates and populates an [IDynamicParameterCompatible](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/) object from the stored properties. ### Returns | Type | Description | | --- | --- | | `{T}` | A new `T` populated from the stored properties. | `public T Restore()` Restores the stored properties as `T`. ### Returns | Type | Description | | --- | --- | | `{T}` | The restored `T` value. | ### Exceptions | Type | Description | | --- | --- | | `Exception` | `T` implements [IDynamicParameterCompatible](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/), but an instance cannot be created or populated. | ### Remarks This overload delegates to [DynamicParameter.Restore(Type)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/). `public object Restore(Type originalType)` Restores the stored properties as an object of a specified type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `originalType` | `Type` | The target [Type](https://learn.microsoft.com/dotnet/api/system.type). | ### Returns | Type | Description | | --- | --- | | `Object` | The restored value. | ### Exceptions | Type | Description | | --- | --- | | `Exception` | `originalType` implements [IDynamicParameterCompatible](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/), but an instance cannot be created or populated. | ### Remarks A [DynamicParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) target returns this instance. A target type that implements IDictionary returns a serializable property dictionary. A target type that implements [IDynamicParameterCompatible](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/) is instantiated and populated through [IDynamicParameterCompatible.SetPropertiesFromDictionary(IDictionary)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/IDynamicParameterCompatible/); all other target types are restored through JSON deserialization. ## Remarks [DynamicParameter.GetProperty(string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/), [DynamicParameter.SetProperty(string, object)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/), and [DynamicParameter.HasProperty(string, bool)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DynamicParameter/) accept period-delimited paths for nested properties. [Previous DropdownValue](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/DropdownValue/) [Next ForkTransitionSearchType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ForkTransitionSearchType/)