Table of Contents

Class GenericProperty<PropertyType>

Namespace
CMS.Base
Assembly
CMS.Base.dll

Represents a generic property

public class GenericProperty<PropertyType> : GenericExtension<PropertyType>, IGenericProperty, IGenericExtension

Type Parameters

PropertyType
Inheritance
object
GenericExtension<PropertyType>
GenericProperty<PropertyType>
Implements
Derived
Inherited Members
Extension Methods

Constructors

GenericProperty()

Empty constructor, creates a property without a name, which expects that its parent property will be set

public GenericProperty()

GenericProperty(string)

Constructor

public GenericProperty(string name)

Parameters

name string

Property name

Properties

Initializer

Property initializer

public Func<PropertyType> Initializer { get; protected set; }

Property Value

Func<PropertyType>

Name

Property name

public override string Name { get; }

Property Value

string

ParentProperty

Parent property. If set, provides value to current extension

public IGenericProperty ParentProperty { get; set; }

Property Value

IGenericProperty

Type

Type of the property

public Type Type { get; }

Property Value

Type

Value

Property value

public virtual PropertyType Value { get; set; }

Property Value

PropertyType

ValueIsSingleton

If true, the property ensures an object instance in it's value if null

public bool ValueIsSingleton { get; protected set; }

Property Value

bool

Methods

AsSingleton()

If set, the value of the object points to a singleton of this object

public void AsSingleton()

GetValue()

Gets the property value for internal purposes

public object GetValue()

Returns

object

RegisterAsStaticPropertyTo(Type, string)

Registers the extension as a property to the given type

public void RegisterAsStaticPropertyTo(Type type, string propertyName)

Parameters

type Type

Target type

propertyName string

Property name

WithLazyInitialization(Func<PropertyType>)

Sets up the lazy initialization over this property

public void WithLazyInitialization(Func<PropertyType> initializer)

Parameters

initializer Func<PropertyType>

Property initializer

Operators

implicit operator PropertyType(GenericProperty<PropertyType>)

Implicit conversion to extension type

public static implicit operator PropertyType(GenericProperty<PropertyType> ext)

Parameters

ext GenericProperty<PropertyType>

Extension to convert

Returns

PropertyType