Class TypeReferenceAnalyzer
Analyses a type looking for properties of a specified type.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 9.12.2Syntax
[ServiceConfiguration(typeof(TypeReferenceAnalyzer))]
[ServiceConfiguration(typeof(ITypeReferenceAnalyzer), IncludeServiceAccessor = false)]
public class TypeReferenceAnalyzer : ITypeReferenceAnalyzer
Remarks
Recursively goes through the public properties of a type and searches for those of a specified typed. Will throw exception if a circular reference is encountered.
Only properties with a public get and set accessor will be validated.
Constructors
TypeReferenceAnalyzer()
Initializes a new instance of the TypeReferenceAnalyzer class.
Declaration
public TypeReferenceAnalyzer()
Methods
Analyze<T>(Type)
Analyze a type for occurrances of a specified base type
Declaration
public IEnumerable<Type> Analyze<T>(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to analyze. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> | The types found matching the |
Type Parameters
Name | Description |
---|---|
T | The public properties have to inherit from this type to be considered a match. |
Remarks
Analyze a type looking for properties of a specified type. Will do so recursivly using reflection on public properties with getter and setter.
Validates if any property of a specific type creates a circular reference. Will throw an exception in that case.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | If circular references are found |