C# Class CK.Core.SimpleTypeFinder

Very simple default implementation of the ISimpleTypeFinder: it can be used as a base class. Static Default and WeakDefault are available.
Inheritance: ISimpleTypeFinder
Mostra file Open project: Invenietis/ck-core Class Usage Examples

Public Methods

Method Description
SplitAssemblyFullName ( string assemblyFullName, string &assemblyName, string &versionCultureAndPublicKeyToken ) : bool

Helper method to split an assembly full name in two parts: "CK.Core, version=1.0.0, culture='fr-FR'" gives "CK.Core" and "version=1.0.0, culture='fr-FR'".

SplitAssemblyQualifiedName ( string assemblyQualifiedName, string &fullTypeName, string &assemblyFullName ) : bool

Helper method to split the assembly qualified name into its assembly name and full type name. "CK.Core.SimpleTypeFinder, CK.Core, version=1.0.0, culture='fr-FR'" gives "CK.Core.SimpleTypeFinder" and "CK.Core, version=1.0.0, culture='fr-FR'".

StandardResolver ( string assemblyQualifiedName, bool throwOnError ) : Type

Direct implementation that checks that the assembly qualified name set as parameter is valid, then calls Type.GetType(string,bool) and converts any exception that may be raised to TypeLoadException.

WeakResolver ( string assemblyQualifiedName, bool throwOnError ) : Type

An implementation of Resolver that can be used to load types regardless of the version, culture, architecture and public key token (strongly-named assemblies) of the type names. (See WeakenAssemblyQualifiedName.)

The type name used is: "NamespaceOfTheType.TypeName, AssemblyName".

WeakenAssemblyQualifiedName ( string assemblyQualifiedName, string &weakTypeName ) : bool

Helper method to remove version, architecture, publicTokenKey and culture from the assembly qualified name into its assembly name passed as parameter. "CK.Core.SimpleTypeFinder, CK.Core, version=1.0.0, culture='fr-FR'" gives "CK.Core.SimpleTypeFinder, CK.Core". Used to remove strong name from an strongly-named assembly qualified name

Private Methods

Method Description
CheckAssemblyQualifiedNameValid ( string assemblyQualifiedName ) : void

Method Details

SplitAssemblyFullName() static public method

Helper method to split an assembly full name in two parts: "CK.Core, version=1.0.0, culture='fr-FR'" gives "CK.Core" and "version=1.0.0, culture='fr-FR'".
static public SplitAssemblyFullName ( string assemblyFullName, string &assemblyName, string &versionCultureAndPublicKeyToken ) : bool
assemblyFullName string The assembly full name.
assemblyName string Set to assembly name only.
versionCultureAndPublicKeyToken string Set to extra information.
return bool

SplitAssemblyQualifiedName() static public method

Helper method to split the assembly qualified name into its assembly name and full type name. "CK.Core.SimpleTypeFinder, CK.Core, version=1.0.0, culture='fr-FR'" gives "CK.Core.SimpleTypeFinder" and "CK.Core, version=1.0.0, culture='fr-FR'".
static public SplitAssemblyQualifiedName ( string assemblyQualifiedName, string &fullTypeName, string &assemblyFullName ) : bool
assemblyQualifiedName string The assembly qualified name to split.
fullTypeName string Full type name on output or an empty string.
assemblyFullName string Weaken type name on output or an empty string.
return bool

StandardResolver() public static method

Direct implementation that checks that the assembly qualified name set as parameter is valid, then calls Type.GetType(string,bool) and converts any exception that may be raised to TypeLoadException.
/// When is true, always throws a type load exception. /// The original error (not a ) is available in the . ///
public static StandardResolver ( string assemblyQualifiedName, bool throwOnError ) : Type
assemblyQualifiedName string The assembly qualified name of a type.
throwOnError bool /// True to ALWAYS throw a if the type is not found. /// It may also throw and when the assembly qualified name is not valid /// False prevents any exception from being thrown and simply returns null. ///
return System.Type

WeakResolver() public static method

An implementation of Resolver that can be used to load types regardless of the version, culture, architecture and public key token (strongly-named assemblies) of the type names. (See WeakenAssemblyQualifiedName.)
The type name used is: "NamespaceOfTheType.TypeName, AssemblyName".
/// When is true, always throws a type load exception. /// The original error (not a ) is available in the . ///
public static WeakResolver ( string assemblyQualifiedName, bool throwOnError ) : Type
assemblyQualifiedName string
throwOnError bool
return System.Type

WeakenAssemblyQualifiedName() static public method

Helper method to remove version, architecture, publicTokenKey and culture from the assembly qualified name into its assembly name passed as parameter. "CK.Core.SimpleTypeFinder, CK.Core, version=1.0.0, culture='fr-FR'" gives "CK.Core.SimpleTypeFinder, CK.Core". Used to remove strong name from an strongly-named assembly qualified name
static public WeakenAssemblyQualifiedName ( string assemblyQualifiedName, string &weakTypeName ) : bool
assemblyQualifiedName string The assembly qualified name to weaken.
weakTypeName string The weakened assembly qualified name on output or an empty string.
return bool