DynamicModel Class
.NET Standard 2.x
A sealed class which represents a dynamic model object that you do not need to specify properties and property datatypes.
It can be used to map the result set dynamically after a SQL query is executed in the database.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
public sealed class DynamicModel;
Properties
| Name | Return Type | Description |
|---|---|---|
| Item[Int32] | object | Gets or sets the value of the property at the specified index. |
| Item[String] | object | Gets or sets the value of the specified property (by name). |
| Properties | IReadOnlyList<IPropertyInfo> | Gets an IReadOnlyList<IPropertyInfo> object which contains information about all of the properties used in the current DynamicModel object. |
| PropertyCount | int | Gets the number of the properties used in the current DynamicModel object. |
Method
| Name | Return Type | Description |
|---|---|---|
| Clone() | DynamicModel | Creates a new DynamicModel object which is a copy of the current DynamiclModel instance. |
| CopyFrom(DynamicModel dynamicModel) | void | Copies data from another DynamicModel object to the current DynamicModel object. |
| CopyFrom(DynamicModel dynamicModel, int propertyStart, int propertyEnd) | void | Copies the values of the properties within the specified scope of another DynamicModel object to the property of the corresponding location of the current DynamicModel object. |
| GetValue(int index) | object | Gets the value of the specified property (by index) in the DynamicModel object. |
| GetValue<TValue>(int index) | TValue | Gets the value of the specified property (by index) in the DynamicModel object, and casts it to the specified data type. |
| GetValue(string columnName) | object | Gets the value of the specified property (by name) in the DynamicModel object. |
| GetValue<TValue>(string columnName) | TValue | Gets the value of the specified property (by name) in the DynamicModel object, and casts it to the specified data type. |
| IndexOf(string name) | int | Gets the zero-based index of the property specified by the property name. |
| SetValue(int index, object value) | void | Sets the value for the specified property (by index) in the DynamicModel object. |
| SetValue(string columnName, object value) | void | Sets the value for the specified property (by name) in the DynamicModel object. |
| SetValues(object[] values) | void | Sets one or more values to the properties in the DynamicModel object according to the order of the property index. |