Click or drag to resize

DynamicDataObject Class

Represents the data objects for working with Casewhere Runtime API.
Inheritance Hierarchy
SystemObject
  System.DynamicDynamicObject
    Casewhere.SystemTypesDynamicDataObject

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

The DynamicDataObject type exposes the following members.

Constructors
  NameDescription
Public methodDynamicDataObject
Create instance of DynamicDataObject without provided data.
Public methodDynamicDataObject(IDictionaryString, Object)
Create instance of DynamicDataObject with provided data with type is IDictionary<string, object>.
Public methodDynamicDataObject(Object)
Create instance of DynamicDataObject with provided data with type is object.
Top
Properties
  NameDescription
Public propertyHasData
Determines if the object has data properties or not.
Public propertyItem
Indexer returns value by property name.
Protected propertyProperties
Actual data.
Top
Methods
  NameDescription
Public methodAdd
Add value with name.
Public methodStatic memberFromObject
Remove value with name if found. Otherwise, throw exception ArgumentNullException.
Public methodGet(String)
Get value by property name.
Public methodGetT(String)
Get value by property name.
Public methodGetDynamicMemberNames
Get the field names.
(Overrides DynamicObjectGetDynamicMemberNames.)
Public methodGetGuid
Get value by property name.
Public methodGetList(String)
Get list of values by property name.
Public methodGetListT(String)
Get list of values by property name.
Public methodGetMetaObject
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.)
Public methodGetProperties
Get actual data of DynamicDataObject.
Public methodHas
Determines if a property has data or not.
Public methodHasKey
Determines if a property has key or not.
Public methodRemove
Remove value with name if found. Otherwise, throw exception ArgumentNullException.
Public methodToExpandoObject
Public methodToJObject
Converts to JObject.
Public methodToString
Converts to string.
(Overrides ObjectToString.)
Public methodTryBinaryOperation
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.)
Public methodTryConvert
Try convert the
(Overrides DynamicObjectTryConvert(ConvertBinder, Object).)
Public methodTryCreateInstance
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.)
Public methodTryDeleteIndex
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.)
Public methodTryDeleteMember
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.)
Public methodTryGetIndex
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.)
Public methodTryGetMember
Get the value of object.
(Overrides DynamicObjectTryGetMember(GetMemberBinder, Object).)
Public methodTryInvoke
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.)
Public methodTryInvokeMember
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.)
Public methodTrySetIndex
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.)
Public methodTrySetMember
Set the value of object. Override if the key is existed.
(Overrides DynamicObjectTrySetMember(SetMemberBinder, Object).)
Public methodTryUnaryOperation
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.)
Top
Examples
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"
See Also