Class TypeResolver
Used only by WCF (SScada).
TODO: the sub folder ExpressionSerializer can be removed (?)
Inheritance
System.Object
TypeResolver
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Sartorius.SAF.dll
Syntax
public sealed class TypeResolver
Constructors
View Source
TypeResolver(IEnumerable<Assembly>, IEnumerable<Type>)
Relying on the constructor only, to load all possible (including IEnumerable, IQueryable, Nullable, Array) Types
into memory, may not scale well.
Declaration
public TypeResolver(IEnumerable<Assembly> assemblies = null, IEnumerable<Type> knownTypes = null)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Reflection.Assembly> |
assemblies |
|
System.Collections.Generic.IEnumerable<System.Type> |
knownTypes |
|
Properties
View Source
KnownTypes
KnownTypes for DataContractSerializer. Only needs to hold the element type, not the collection or array type.
Declaration
public ReadOnlyCollection<Type> KnownTypes { get; }
Property Value
Type |
Description |
System.Collections.ObjectModel.ReadOnlyCollection<System.Type> |
|
Methods
View Source
GetBaseTypes(Type)
Declaration
public static IEnumerable<Type> GetBaseTypes(Type expectedType)
Parameters
Type |
Name |
Description |
System.Type |
expectedType |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Type> |
|
View Source
GetDerivedTypes(Type)
For determining KnownType(s) to declare on a DataContract
Declaration
public static List<Type> GetDerivedTypes(Type baseType)
Parameters
Type |
Name |
Description |
System.Type |
baseType |
|
Returns
Type |
Description |
System.Collections.Generic.List<System.Type> |
|
View Source
GetElementType(Type)
Declaration
public static Type GetElementType(Type collectionType)
Parameters
Type |
Name |
Description |
System.Type |
collectionType |
|
Returns
Type |
Description |
System.Type |
|
View Source
GetMethod(Type, String, Type[], Type[])
Declaration
public static MethodInfo GetMethod(Type declaringType, string name, Type[] parameterTypes, Type[] genArgTypes)
Parameters
Type |
Name |
Description |
System.Type |
declaringType |
|
System.String |
name |
|
System.Type[] |
parameterTypes |
|
System.Type[] |
genArgTypes |
|
Returns
Type |
Description |
System.Reflection.MethodInfo |
|
View Source
GetOrCreateAnonymousTypeFor(String, NameTypePair[], NameTypePair[])
Declaration
public Type GetOrCreateAnonymousTypeFor(string name, NameTypePair[] properties, NameTypePair[] ctrParams)
Parameters
Returns
Type |
Description |
System.Type |
|
View Source
GetType(String)
Declaration
public Type GetType(string typeName)
Parameters
Type |
Name |
Description |
System.String |
typeName |
|
Returns
Type |
Description |
System.Type |
|
View Source
GetType(String, IEnumerable<Type>)
Declaration
public Type GetType(string typeName, IEnumerable<Type> genericArgumentTypes)
Parameters
Type |
Name |
Description |
System.String |
typeName |
|
System.Collections.Generic.IEnumerable<System.Type> |
genericArgumentTypes |
|
Returns
Type |
Description |
System.Type |
|
View Source
HasBaseType(Type, Type)
Declaration
public static bool HasBaseType(Type thisType, Type baseType)
Parameters
Type |
Name |
Description |
System.Type |
thisType |
|
System.Type |
baseType |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
HasInheritedProperty(Type, PropertyInfo)
Declaration
public static bool HasInheritedProperty(Type declaringType, PropertyInfo pInfo)
Parameters
Type |
Name |
Description |
System.Type |
declaringType |
|
System.Reflection.PropertyInfo |
pInfo |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
HasMappedKnownType(Type)
Declaration
public bool HasMappedKnownType(Type input)
Parameters
Type |
Name |
Description |
System.Type |
input |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
HasMappedKnownType(Type, out Type)
Checks if the input Type is "mapped" or otherwise somehow related (e.g. Array) to a KnownType found in this.KnownTypes.
Declaration
public bool HasMappedKnownType(Type input, out Type knownType)
Parameters
Type |
Name |
Description |
System.Type |
input |
|
System.Type |
knownType |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
IsIEnumerableOf(Type, Type)
Declaration
public static bool IsIEnumerableOf(Type enumerableType, Type elementType)
Parameters
Type |
Name |
Description |
System.Type |
enumerableType |
the candidate enumerable Type in question
|
System.Type |
elementType |
is the candidate type a IEnumerable of elementType
|
Returns
Type |
Description |
System.Boolean |
|
View Source
IsNullableType(Type)
Declaration
public static bool IsNullableType(Type t)
Parameters
Type |
Name |
Description |
System.Type |
t |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
ToGenericTypeFullNameString(Type)
Declaration
public static string ToGenericTypeFullNameString(Type t)
Parameters
Type |
Name |
Description |
System.Type |
t |
|
Returns
Type |
Description |
System.String |
|
View Source
ToGenericTypeNameString(Type)
Declaration
public static string ToGenericTypeNameString(Type t)
Parameters
Type |
Name |
Description |
System.Type |
t |
|
Returns
Type |
Description |
System.String |
|
Extension Methods