DynamicDataObject Class

Represents the data objects for working with Casewhere Runtime API.

Definition

Namespace: Casewhere.SystemTypes
Assembly: Casewhere.SystemTypes (in Casewhere.SystemTypes.dll) Version: 1.0.0.0 (1.0.0.0)
C#
public class DynamicDataObject : DynamicObject
Inheritance
Object    DynamicObject    DynamicDataObject

Example

C#
                    var employee = ctx.Input; // employee is DynamicDataOject

Log.Info("Username: {Username}", employee["Username"]); // Username: "aadamowicz2o" 
Log.Info("Username: {Username}", employee.Get<string>("Username")); // Username: "aadamowicz2o"

Log.Info("Skills: {Skills}", employee["Skills"]); // Skills: ["java", "Fortran", "cpp"] 
Log.Info("Skills: {Skills}", employee.GetList<string>("Skills")); // Skills: ["java", "Fortran", "cpp"]

Log.Info("Departments: {Departments}", employee["SubDepartmentIds"]); // Departments: ["Department/6b9cd2ad-35d2-452e-9f60-a9c3006b21f3", "Department/24895ee7-5e4d-4130-ae2e-a9ca010731e0", "Department/2dd9ef92-efd5-419f-8448-a9b5009b426d"] 
Log.Info("Departments: {Departments}", employee.GetList<string>("SubDepartmentIds")); // Departments: ["Department/6b9cd2ad-35d2-452e-9f60-a9c3006b21f3", "Department/24895ee7-5e4d-4130-ae2e-a9ca010731e0", "Department/2dd9ef92-efd5-419f-8448-a9b5009b426d"]

dynamic emp = ctx.Input; // use as dynamic variable
Log.Info("Username: {Username}", emp.Username); // Username: "aadamowicz2o"
                  

Constructors

DynamicDataObject Create instance of DynamicDataObject without provided data.
DynamicDataObject(IDictionaryString, Object) Create instance of DynamicDataObject with provided data with type is IDictionary<string, object>.
DynamicDataObject(Object) Create instance of DynamicDataObject with provided data with type is object.

Properties

HasData Determines if the object has data properties or not.
Item Indexer returns value by property name.
Properties Actual data.

Methods

Add Add value with name.
FromObject Remove value with name if found. Otherwise, throw exception ArgumentNullException.
Get(String) Get value by property name.
GetT(String) Get value by property name.
GetArray(String) Get array of values by property name.
GetArrayT(String) Get array of values by property name.
GetDynamicMemberNames Get the field names.
(Overrides DynamicObjectGetDynamicMemberNames)
GetGuid Get value by property name.
GetList(String) Get list of values by property name.
GetListT(String) Get list of values by property name.
GetMetaObject Provides a DynamicMetaObject that dispatches to the dynamic virtual methods. The object can be encapsulated inside another DynamicMetaObject to provide custom behavior for individual actions. This method supports the Dynamic Language Runtime infrastructure for language implementers and it is not intended to be used directly from your code.
(Inherited from DynamicObject)
GetProperties Get actual data of DynamicDataObject.
Has Determines if a property has data or not.
HasKey Determines if a property has key or not.
Remove Remove value with name if found. Otherwise, throw exception ArgumentNullException.
ToExpandoObject  
ToJObject Converts to JObject.
ToString Converts to string.
(Overrides ObjectToString)
TryBinaryOperation Provides implementation for binary operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as addition and multiplication.
(Inherited from DynamicObject)
TryConvert Try convert the
(Overrides DynamicObjectTryConvert(ConvertBinder, Object))
TryCreateInstance Provides the implementation for operations that initialize a new instance of a dynamic object. This method is not intended for use in C# or Visual Basic.
(Inherited from DynamicObject)
TryDeleteIndex Provides the implementation for operations that delete an object by index. This method is not intended for use in C# or Visual Basic.
(Inherited from DynamicObject)
TryDeleteMember Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic.
(Inherited from DynamicObject)
TryGetIndex Provides the implementation for operations that get a value by index. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for indexing operations.
(Inherited from DynamicObject)
TryGetMember Get the value of object.
(Overrides DynamicObjectTryGetMember(GetMemberBinder, Object))
TryInvoke Provides the implementation for operations that invoke an object. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate.
(Inherited from DynamicObject)
TryInvokeMember Provides the implementation for operations that invoke a member. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as calling a method.
(Inherited from DynamicObject)
TrySetIndex Provides the implementation for operations that set a value by index. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that access objects by a specified index.
(Inherited from DynamicObject)
TrySetMember Set the value of object. Override if the key is existed.
(Overrides DynamicObjectTrySetMember(SetMemberBinder, Object))
TryUnaryOperation Provides implementation for unary operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as negation, increment, or decrement.
(Inherited from DynamicObject)

See Also