Class RegisteredProperties<TParent>
Container for the property registration
public class RegisteredProperties<TParent>
Type Parameters
TParent
- Inheritance
-
objectRegisteredProperties<TParent>
- Extension Methods
Constructors
RegisteredProperties(RegistrationCallbackHandler)
Constructor
public RegisteredProperties(RegisteredProperties<TParent>.RegistrationCallbackHandler registrationCallback)
Parameters
registrationCallbackRegisteredProperties<TParent>.RegistrationCallbackHandlerCallback method called when the request for registering of the properties is made
Fields
mPropertiesRegistered
If true, the properties of this type were already registered
protected bool mPropertiesRegistered
Field Value
- bool
mPropertyFunctions
Collection of the properties registered by the lambda function.
protected StringSafeDictionary<PropertySettings<TParent>> mPropertyFunctions
Field Value
- StringSafeDictionary<PropertySettings<TParent>>
mRegisteredProperties
List of registered properties
protected List<string> mRegisteredProperties
Field Value
- List<string>
mRegistrationCallback
Registration callback method
protected RegisteredProperties<TParent>.RegistrationCallbackHandler mRegistrationCallback
Field Value
Methods
AddProperty(string)
Adds the property name to the collection of registered properties (Ensures locking for thread safety)
protected void AddProperty(string propertyName)
Parameters
propertyNamestringProperty name
Add<TProperty>(string, Func<TParent, object>, Action<TParent, object>)
Registers the given property to the object
public PropertySettings<TParent> Add<TProperty>(string propertyName, Func<TParent, object> lambdaExpr, Action<TParent, object> setLambdaExpr)
Parameters
propertyNamestringProperty name
lambdaExprFunc<TParent, object>Lambda expression for the getter of the property (object) => return value
setLambdaExprAction<TParent, object>Lambda expression for the setter of the property (object, value) => set
Returns
- PropertySettings<TParent>
Type Parameters
TProperty
Add<PropertyType>(string, object, Func<TParent, object, object>, Action<TParent, object, object>)
Registers the given parametrized property to the object.
public PropertySettings<TParent> Add<PropertyType>(string propertyName, object parameter, Func<TParent, object, object> lambdaExpr, Action<TParent, object, object> setLambdaExpr) where PropertyType : new()
Parameters
propertyNamestringProperty name
parameterobjectParameter for the lambda expression
lambdaExprFunc<TParent, object, object>Lambda expression for the getter of the property (object, parameter) => return value
setLambdaExprAction<TParent, object, object>Lambda expression for the setter of the property (object, parameter, value) => set
Returns
- PropertySettings<TParent>
Type Parameters
PropertyType
CollectColumns(Type)
Collects the marked properties from the given object
public void CollectColumns(Type type)
Parameters
typeTypeType for which collect the properties
CollectProperties(Type)
Collects the marked properties from the given object
public void CollectProperties(Type type)
Parameters
typeTypeType for which collect the properties
Contains(string)
Returns true if given property is already registered.
public bool Contains(string propertyName)
Parameters
propertyNamestringProperty name
Returns
- bool
Evaluate(TParent, string, out object)
Evaluates the particular property
public bool Evaluate(TParent obj, string columnName, out object value)
Parameters
objTParentCalling object
columnNamestringColumn name
valueobjectReturning the property value
Returns
- bool
GetPropertyType(string)
Gets the type of the given property
public Type GetPropertyType(string propertyName)
Parameters
propertyNamestringProperty name
Returns
- Type
GetRegisteredProperties()
Gets list of registered properties.
public List<string> GetRegisteredProperties()
Returns
- List<string>
HasSetter(string)
Returns true if given property has a setter
public bool HasSetter(string columnName)
Parameters
columnNamestringColumn name
Returns
- bool
Hide(string)
Hides the given property from the property list
public void Hide(string propertyName)
Parameters
propertyNamestringProperty name
Exceptions
- Exception
Thrown when property is not registered and therefore cannot be hidden.
RemoveProperty(string)
Removes the property name to the collection of registered properties (Ensures locking for thread safety)
protected bool RemoveProperty(string propertyName)
Parameters
propertyNamestringProperty name
Returns
- bool
Returns true if property name was successfully removed, otherwise false
Set(TParent, string, object)
Evaluates the particular property
public bool Set(TParent obj, string columnName, object value)
Parameters
objTParentCalling object
columnNamestringColumn name
valueobjectReturning the property value
Returns
- bool