Show / Hide Table of Contents

    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
    System.Object
    System.Dynamic.DynamicObject
    FlowMessage
    Inherited Members
    System.Dynamic.DynamicObject.GetMetaObject(System.Linq.Expressions.Expression)
    System.Dynamic.DynamicObject.TryBinaryOperation(System.Dynamic.BinaryOperationBinder, System.Object, System.Object)
    System.Dynamic.DynamicObject.TryConvert(System.Dynamic.ConvertBinder, System.Object)
    System.Dynamic.DynamicObject.TryCreateInstance(System.Dynamic.CreateInstanceBinder, System.Object[], System.Object)
    System.Dynamic.DynamicObject.TryDeleteIndex(System.Dynamic.DeleteIndexBinder, System.Object[])
    System.Dynamic.DynamicObject.TryDeleteMember(System.Dynamic.DeleteMemberBinder)
    System.Dynamic.DynamicObject.TryGetIndex(System.Dynamic.GetIndexBinder, System.Object[], System.Object)
    System.Dynamic.DynamicObject.TryInvoke(System.Dynamic.InvokeBinder, System.Object[], System.Object)
    System.Dynamic.DynamicObject.TryInvokeMember(System.Dynamic.InvokeMemberBinder, System.Object[], System.Object)
    System.Dynamic.DynamicObject.TrySetIndex(System.Dynamic.SetIndexBinder, System.Object[], System.Object)
    System.Dynamic.DynamicObject.TryUnaryOperation(System.Dynamic.UnaryOperationBinder, System.Object)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    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
    IFlowMessage.Item[String]
    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
    IFlowMessage.Properties

    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
    IFlowMessage.AddAllProperties<T>(IFlowMessage, String, T, Boolean, Boolean)

    Clone()

    Will return a new FlowMessage based on the properties dynamically added to the current object

    Declaration
    public IFlowMessage Clone()
    Returns
    IFlowMessage

    Implements
    IFlowMessage.Clone()

    GetDynamicMemberNames()

    Declaration
    public override IEnumerable<string> GetDynamicMemberNames()
    Returns
    System.Collections.Generic.IEnumerable<System.String>

    Overrides
    System.Dynamic.DynamicObject.GetDynamicMemberNames()

    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
    IFlowMessage.GetProperties()

    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
    IFlowMessage.GetProperty<T>(IFlowMessage, String)

    GetValue<T>(String)

    Declaration
    public T GetValue<T>(string path)
    Parameters
    System.String path

    Returns
    T

    Type Parameters
    T

    Implements
    IFlowMessage.GetValue<T>(String)

    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
    IFlowMessage.HasOwnProperty(String)

    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
    IFlowMessage.HasOwnProperty<T>(String)

    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
    IFlowMessage.RemoveProperty(String)

    SetError(String)

    Declaration
    public void SetError(string message = "")
    Parameters
    System.String message

    Implements
    IFlowMessage.SetError(String)

    SetSuccess()

    Declaration
    public void SetSuccess()
    Implements
    IFlowMessage.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
    IFlowMessage.SetValue<T>(String, T, Boolean, Boolean)

    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
    System.Dynamic.DynamicObject.TryGetMember(System.Dynamic.GetMemberBinder, System.Object)

    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

    Overrides
    System.Dynamic.DynamicObject.TrySetMember(System.Dynamic.SetMemberBinder, System.Object)

    Extension Methods

    MessageFilterExtensions.FilterApplyAll(IFlowMessage, List<MessageFilter>)
    MessageFilterExtensions.FilterApplyAny(IFlowMessage, List<MessageFilter>)
    FlowMessageExtensions.DeepCopy(IFlowMessage)
    FlowMessageExtensions.RemoveChangedProperties(IFlowMessage, IFlowMessage)
    FlowMessageExtensions.GetPropertyLevel(IFlowMessage, String, String)
    FlowMessageExtensions.Serialize(IFlowMessage)
    Back to top Crosser SDK