Try our conversational search powered by Generative AI!

Class Reflector

Helper class for extracting and caching type information The class is thread safe

Inheritance
System.Object
Reflector
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: EPiServer.Data.Dynamic
Assembly: EPiServer.Data.dll
Version: 8.11.0
Syntax
public static class Reflector

Methods

GenerateTypeBag(Type, Boolean)

Get a Collection of property names to System.Type

Declaration
public static Dictionary<string, Type> GenerateTypeBag(Type type, bool excludeIds)
Parameters
Type Name Description
System.Type type

The System.Type to get the collection for

System.Boolean excludeIds
true
if the special id properties should be excluded from the returned type bag, otherwise
false
Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Type>

A Dictionary<string, Type>

GenerateTypeBag(Type, Boolean, out StoreDefinitionParameters)

Get a Collection of property names to System.Type

Declaration
public static Dictionary<string, Type> GenerateTypeBag(Type type, bool excludeIds, out StoreDefinitionParameters parameters)
Parameters
Type Name Description
System.Type type

The System.Type to get the collection for

System.Boolean excludeIds
true
if the special id properties should be excluded from the returned type bag, otherwise
false
StoreDefinitionParameters parameters

A StoreDefinitionParameters instance whose member lists will be filled with information collected from property attributes/>

Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Type>

A Dictionary<string, Type>

GetProperties(Type, Boolean)

Get a Collection of property names to System.Reflection.PropertyInfo

Declaration
public static Dictionary<string, PropertyInfo> GetProperties(Type type, bool excludeId)
Parameters
Type Name Description
System.Type type

The System.Type to reflect

System.Boolean excludeId

A System.Boolean indicating if the 'Id' property should be excluded from the collection

Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Reflection.PropertyInfo>

A Dictionary<string, PropertyInfo>

GetProperties<T>(Boolean)

Get a Collection of property names to System.Reflection.PropertyInfo

Declaration
public static Dictionary<string, PropertyInfo> GetProperties<T>(bool excludeId)
Parameters
Type Name Description
System.Boolean excludeId

A System.Boolean indicating if the 'Id' property should be excluded from the collection

Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Reflection.PropertyInfo>

A Dictionary<string, PropertyInfo>

Type Parameters
Name Description
T

The System.Type to reflect

GetStoreDefinitionParametersForType(Type)

Declaration
public static StoreDefinitionParameters GetStoreDefinitionParametersForType(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
StoreDefinitionParameters

GetStoreDefinitionParametersForType(Type, Boolean)

Declaration
public static StoreDefinitionParameters GetStoreDefinitionParametersForType(Type type, bool excludeIds)
Parameters
Type Name Description
System.Type type
System.Boolean excludeIds
Returns
Type Description
StoreDefinitionParameters

HasProperty(Type, String)

Returns whether the Type defines the property with name propertyName

Declaration
public static bool HasProperty(Type containerType, string propertyName)
Parameters
Type Name Description
System.Type containerType

The Type to operate on

System.String propertyName

The name of the property to check for

Returns
Type Description
System.Boolean
true
if the Type defines the property, otherwise
false

IsPropertyOfType(Type, String, Type)

Returns whether the Type defines the property with name propertyName and if it is of Type propertyType

Declaration
public static bool IsPropertyOfType(Type containerType, string propertyName, Type propertyType)
Parameters
Type Name Description
System.Type containerType

The Type to operate on

System.String propertyName

The name of the property to check for

System.Type propertyType

The Type the property should be

Returns
Type Description
System.Boolean
true
if the Type defines the property and it is of the Type specified, otherwise
false

RemoveFromCache(Type)

Removes type from cache.

Declaration
public static void RemoveFromCache(Type type)
Parameters
Type Name Description
System.Type type

The System.Type to remove

RemoveFromCache<T>()

Removes the langword_csharp_typeof T from the cache.

Declaration
public static void RemoveFromCache<T>()
Type Parameters
Name Description
T

The System.Type to remove