Class Reflector
A helper class that reflects the transformation rules that reside as nested classes within a given type
Inherited Members
Namespace: NMF.Transformations
Assembly: NMF.Transformations.dll
Syntax
public static class Reflector
Methods
| Edit this page View SourceReflectDictionary<T>(Stack<Type>, Func<IEnumerable<T>>, Func<IEnumerable<T>>)
Obtains the rules from the given type stack
Declaration
public static IDictionary<Type, T> ReflectDictionary<T>(Stack<Type> typeStack, Func<IEnumerable<T>> createDefaults, Func<IEnumerable<T>> createCustoms) where T : class
Parameters
Type | Name | Description |
---|---|---|
Stack<Type> | typeStack | A stack of types from which to reflect the rules |
Func<IEnumerable<T>> | createDefaults | A function that returns the defaults |
Func<IEnumerable<T>> | createCustoms | A function that returns the customs |
Returns
Type | Description |
---|---|
IDictionary<Type, T> | A collection of rules |
Type Parameters
Name | Description |
---|---|
T | The type of rules |
ReflectInType<T>(Type, Action<Type, T>)
Reflects a type and instantiates all transformation rules contained in this type as nested classes
Declaration
public static void ReflectInType<T>(Type transformationType, Action<Type, T> persistor) where T : class
Parameters
Type | Name | Description |
---|---|---|
Type | transformationType | The type that should be reflected |
Action<Type, T> | persistor | A method that should be executed to save the reflected transformation rule |
Type Parameters
Name | Description |
---|---|
T |
Remarks
This method reflects the nested classes contained in the given type. It does not look in base types!
Exceptions
Type | Condition |
---|---|
ArgumentNullException | An ArgumentNullException is thrown if the transformationType parameter is passed a null instance |
ArgumentNullException | An ArgumentNullException is thrown if the persistor parameter is passed a null instance |