Class FlowMessage
This is a customized version of the .NET System.Dynamic.DynamicObject. The object is mainly used to pass data between modules in a flow with the possibility to change/remove/add properties at runtime
Inheritance
Inherited Members
Namespace: Crosser.EdgeNode.Flows.Models.Abstractions.Models.FlowMessage
Assembly: Crosser.EdgeNode.Flows.Abstractions.dll
Syntax
public class FlowMessage : DynamicObject, IFlowMessage, IDynamicMetaObjectProvider
Examples
You can build any object by creating a new FlowMessage as a dynamic and just set properties
dynamic d = new FlowMessage();
d.name = "Harry The Hippo";
d.age = 35;
You can also build object with dot-notation.
dynamic o = new FlowMessage();
p.person.name = "Harry The Hippo";
d.person.age = 35;
Constructors
FlowMessage()
This constructor just works off the internal dictionary and any public properties of this object.
Note you can subclass FlowMessage.
Declaration
public FlowMessage()
Fields
MESSAGE_PROPERTY
Declaration
public const string MESSAGE_PROPERTY = "crosser.message"
Field Value
System.String
|
SUCCESS_PROPERTY
Declaration
public const string SUCCESS_PROPERTY = "crosser.success"
Field Value
System.String
|
Properties
Item[String]
Convenience method that provides a string Indexer to the Properties collection AND the strongly typed properties of the object by name.
// dynamic exp["Address"] = "112 nowhere lane"; // strong var name = exp["StronglyTypedProperty"] as string;
Declaration
public object this[string key] { get; set; }
Parameters
System.String
key
|
Property Value
System.Object
|
Implements
Remarks
The getter checks the Properties dictionary first then looks in PropertyInfo for properties. The setter checks the instance properties before checking the Properties dictionary.
Properties
Properties dynamically added to the object
Declaration
public Dictionary<string, object> Properties { get; set; }
Property Value
System.Collections.Generic.Dictionary<System.String, System.Object>
|
Implements
Methods
AddAllProperties<T>(IFlowMessage, String, T, Boolean, Boolean)
Declaration
public void AddAllProperties<T>(IFlowMessage msg, string key, T value, bool allowConvertToFlowMessage = false, bool autoCreate = true)
Parameters
IFlowMessage
msg
|
System.String
key
|
T
value
|
System.Boolean
allowConvertToFlowMessage
|
System.Boolean
autoCreate
|
Type Parameters
T
|
Implements
Clone()
Will return a new FlowMessage based on the properties dynamically added to the current object
Declaration
public IFlowMessage Clone()
Returns
IFlowMessage
|
Implements
GetDynamicMemberNames()
Declaration
public override IEnumerable<string> GetDynamicMemberNames()
Returns
System.Collections.Generic.IEnumerable<System.String>
|
Overrides
GetProperties()
Returns and the properties of
Declaration
public IEnumerable<KeyValuePair<string, object>> GetProperties()
Returns
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Object>>
|
Implements
GetProperty<T>(IFlowMessage, String)
Declaration
public T GetProperty<T>(IFlowMessage msg, string key)
Parameters
IFlowMessage
msg
|
System.String
key
|
Returns
T
|
Type Parameters
T
|
Implements
GetValue<T>(String)
Declaration
public T GetValue<T>(string path)
Parameters
System.String
path
|
Returns
T
|
Type Parameters
T
|
Implements
HasOwnProperty(String)
Check if the object has a property with a specific name defined
Declaration
public bool HasOwnProperty(string name)
Parameters
System.String
name
The property-name to look for |
Returns
System.Boolean
|
Implements
HasOwnProperty<T>(String)
Check if the object has a property with a specific name and type defined
Declaration
public bool HasOwnProperty<T>(string name)
Parameters
System.String
name
|
Returns
System.Boolean
|
Type Parameters
T
The expected type of the property |
Implements
IsComplex(Object)
Declaration
public static bool IsComplex(object o)
Parameters
System.Object
o
|
Returns
System.Boolean
|
RemoveProperty(String)
Declaration
public void RemoveProperty(string key)
Parameters
System.String
key
|
Implements
SetError(String)
Declaration
public void SetError(string message = "")
Parameters
System.String
message
|
Implements
SetSuccess()
SetValue<T>(String, T, Boolean, Boolean)
Declaration
public void SetValue<T>(string path, T value, bool allowConvertToFlowMessage = false, bool autoCreate = true)
Parameters
System.String
path
|
T
value
|
System.Boolean
allowConvertToFlowMessage
|
System.Boolean
autoCreate
|
Type Parameters
T
|
Implements
TryGetMember(GetMemberBinder, out Object)
Try to retrieve a member by name first from instance properties followed by the collection entries.
Declaration
public override bool TryGetMember(GetMemberBinder binder, out object result)
Parameters
System.Dynamic.GetMemberBinder
binder
|
System.Object
result
|
Returns
System.Boolean
|
Overrides
TrySetMember(SetMemberBinder, Object)
Will set Properties binder.Name to the value passed in
Declaration
public override bool TrySetMember(SetMemberBinder binder, object value)
Parameters
System.Dynamic.SetMemberBinder
binder
|
System.Object
value
|
Returns
System.Boolean
|