Class CustomTypeHelper
Custom Type-Helper to extend ViewModels with dynamic properties
Implements
System.Reflection.ICustomTypeProvider
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Simplic.UI.MVC
Assembly: Simplic.UI.dll
Syntax
public class CustomTypeHelper : ICustomTypeProvider
Constructors
| Improve this Doc View SourceCustomTypeHelper()
Initialize new instance
Declaration
public CustomTypeHelper()
Properties
| Improve this Doc View SourceCustomPropertyValues
Gets all custom property values
Declaration
protected Dictionary<string, object> CustomPropertyValues { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
TypePropertiesMap
Gets a list of custom type properties
Declaration
public static IDictionary<Type, IList<CustomTypeHelper.CustomPropertyInfoHelper>> TypePropertiesMap { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Type, System.Collections.Generic.IList<CustomTypeHelper.CustomPropertyInfoHelper>> |
Methods
| Improve this Doc View SourceAddProperty(String)
Declaration
public void AddProperty(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
AddProperty(String, Type)
Declaration
public void AddProperty(string name, Type propertyType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.Type | propertyType |
AddProperty(String, Type, List<Attribute>)
Declaration
public void AddProperty(string name, Type propertyType, List<Attribute> attributes)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.Type | propertyType | |
System.Collections.Generic.List<System.Attribute> | attributes |
CheckIfCustomPropertyExists(String)
Checks whether the custom property exists
Declaration
protected bool CheckIfCustomPropertyExists(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the property |
Returns
Type | Description |
---|---|
System.Boolean | True of the property exists |
CheckIfNameExists(String)
Checkts whether a property exists
Declaration
protected bool CheckIfNameExists(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the property |
Returns
Type | Description |
---|---|
System.Boolean | Returns true of the property exists, else false |
GetCustomType()
Get the custom created type
Declaration
public Type GetCustomType()
Returns
Type | Description |
---|---|
System.Type | Type instance |
GetProperties()
Get all property infos of the custom type
Declaration
public PropertyInfo[] GetProperties()
Returns
Type | Description |
---|---|
System.Reflection.PropertyInfo[] | Property information |
GetPropertyValue(String)
Get a value from a custom property
Declaration
public object GetPropertyValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Property name |
Returns
Type | Description |
---|---|
System.Object | Value if the property exists, else an exception will be thrown |
SetPropertyValue(String, Object)
Set the value for an existing property. Throws an exception if the property does not exists
Declaration
public void SetPropertyValue(string propertyName, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Property name |
System.Object | value | Value to set |
Implements
System.Reflection.ICustomTypeProvider