Table of Contents

Class RegisteredProperties<TParent>

Namespace
CMS.Base
Assembly
CMS.Base.dll

Container for the property registration

public class RegisteredProperties<TParent>

Type Parameters

TParent
Inheritance
object
RegisteredProperties<TParent>
Extension Methods

Constructors

RegisteredProperties(RegistrationCallbackHandler)

Constructor

public RegisteredProperties(RegisteredProperties<TParent>.RegistrationCallbackHandler registrationCallback)

Parameters

registrationCallback RegisteredProperties<TParent>.RegistrationCallbackHandler

Callback 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

RegisteredProperties<TParent>.RegistrationCallbackHandler

Methods

AddProperty(string)

Adds the property name to the collection of registered properties (Ensures locking for thread safety)

protected void AddProperty(string propertyName)

Parameters

propertyName string

Property 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

propertyName string

Property name

lambdaExpr Func<TParent, object>

Lambda expression for the getter of the property (object) => return value

setLambdaExpr Action<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

propertyName string

Property name

parameter object

Parameter for the lambda expression

lambdaExpr Func<TParent, object, object>

Lambda expression for the getter of the property (object, parameter) => return value

setLambdaExpr Action<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

type Type

Type for which collect the properties

CollectProperties(Type)

Collects the marked properties from the given object

public void CollectProperties(Type type)

Parameters

type Type

Type for which collect the properties

Contains(string)

Returns true if given property is already registered.

public bool Contains(string propertyName)

Parameters

propertyName string

Property name

Returns

bool

Evaluate(TParent, string, out object)

Evaluates the particular property

public bool Evaluate(TParent obj, string columnName, out object value)

Parameters

obj TParent

Calling object

columnName string

Column name

value object

Returning the property value

Returns

bool

GetPropertyType(string)

Gets the type of the given property

public Type GetPropertyType(string propertyName)

Parameters

propertyName string

Property 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

columnName string

Column name

Returns

bool

Hide(string)

Hides the given property from the property list

public void Hide(string propertyName)

Parameters

propertyName string

Property 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

propertyName string

Property 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

obj TParent

Calling object

columnName string

Column name

value object

Returning the property value

Returns

bool