C# Класс NHibernate.Type.TypeFactory

Used internally to obtain instances of IType.
Applications should use static methods and constants on NHibernate.NHibernateUtil if the default IType is good enough. For example, the TypeFactory should only be used when the String needs to have a length of 300 instead of 255. At this point NHibernateUtil.String does not get you the correct IType. Instead use TypeFactory.GetString(300) and keep a local variable that holds a reference to the IType.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Array ( string role, string propertyRef, bool embedded, System elementClass ) : NHibernate.Type.CollectionType
Basic ( string name ) : IType

Given the name of a Hibernate type such as Decimal, Decimal(19,0) , Int32, or even NHibernate.Type.DecimalType, NHibernate.Type.DecimalType(19,0), NHibernate.Type.Int32Type, then return an instance of NHibernate.Type.IType

This method will return null if the name is not found in the basicNameMap.

CustomCollection ( string typeName, string>.IDictionary typeParameters, string role, string propertyRef, bool embedded ) : NHibernate.Type.CollectionType
GenericBag ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
GenericIdBag ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
GenericList ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
GenericMap ( string role, string propertyRef, System indexClass, System elementClass ) : NHibernate.Type.CollectionType
GenericOrderedSet ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
GenericSet ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
GenericSortedDictionary ( string role, string propertyRef, object comparer, System indexClass, System elementClass ) : NHibernate.Type.CollectionType
GenericSortedList ( string role, string propertyRef, object comparer, System indexClass, System elementClass ) : NHibernate.Type.CollectionType
GenericSortedSet ( string role, string propertyRef, object comparer, System elementClass ) : NHibernate.Type.CollectionType
HeuristicType ( string typeName ) : IType

Uses heuristics to deduce a NHibernate type given a string naming the type.

When looking for the NHibernate type it will look in the cache of the Basic types first. If it doesn't find it in the cache then it uses the typeName to get a reference to the Class (Type in .NET). Once we get the reference to the .NET class we check to see if it implements IType, ICompositeUserType, IUserType, ILifecycle (Association), or IPersistentEnum. If none of those are implemented then we will serialize the Type to the database using NHibernate.Type.SerializableType(typeName)

HeuristicType ( string typeName, string>.IDictionary parameters ) : IType

Uses heuristics to deduce a NHibernate type given a string naming the type.

HeuristicType ( string typeName, string>.IDictionary parameters, int length ) : IType

Uses heuristics to deduce a NHibernate type given a string naming the type.

InjectParameters ( Object type, string>.IDictionary parameters ) : void
ManyToOne ( string persistentClass ) : EntityType

A many-to-one association type for the given class and cascade style.

ManyToOne ( string persistentClass, bool lazy ) : EntityType

A many-to-one association type for the given class and cascade style.

ManyToOne ( string persistentClass, string uniqueKeyPropertyName, bool lazy, bool unwrapProxy, bool isEmbeddedInXML, bool ignoreNotFound, bool isLogicalOneToOne ) : EntityType

A many-to-one association type for the given class and cascade style.

OneToOne ( string persistentClass, ForeignKeyDirection foreignKeyType, string uniqueKeyPropertyName, bool lazy, bool unwrapProxy, bool isEmbeddedInXML, string entityName, string propertyName ) : EntityType

A one-to-one association type for the given class and cascade style.

Приватные методы

Метод Описание
AddToTypeOfName ( string key, IType type ) : void
AddToTypeOfNameWithLength ( string key, IType type ) : void
AddToTypeOfNameWithPrecision ( string key, IType type ) : void
BuiltInType ( string typeName, byte precision, byte scale ) : IType
BuiltInType ( string typeName, int length ) : IType
GetAnsiStringType ( int length ) : NullableType
GetBinaryType ( int length ) : NullableType
GetClrTypeAliases ( System systemType ) : IEnumerable
GetKeyForLengthBased ( string name, int length ) : string
GetKeyForPrecisionScaleBased ( string name, byte precision, byte scale ) : string
GetSerializableType ( System serializableType ) : NullableType
GetSerializableType ( System serializableType, int length ) : NullableType
GetSerializableType ( int length ) : NullableType
GetStringType ( int length ) : NullableType
GetType ( NullableType defaultUnqualifiedType, byte precision, byte scale, NullableTypeCreatorDelegate ctor ) : NullableType
GetType ( NullableType defaultUnqualifiedType, int length, GetNullableTypeWithLength ctorDelegate ) : NullableType
GetTypeClassification ( string typeName ) : TypeClassification

Gets the classification of the Type based on the string.

This parses through the string and makes the assumption that no class name and no assembly name will contain the "(".

If it finds the "(" and then finds a "," afterwards then it is a TypeClassification.PrecisionScale.

If it finds the "(" and doesn't find a "," afterwards, then it is a TypeClassification.Length.

If it doesn't find the "(" then it assumes that it is a TypeClassification.Plain.

GetTypeType ( int length ) : NullableType
RegisterBuiltInTypes ( ) : void

Register other NO Default .NET type

These type will be used only when the "type" attribute was is specified in the mapping. These are in here because needed to NO override default CLR types and be available in mappings

RegisterDefaultNetTypes ( ) : void

Register other Default .NET type

These type will be used, as default, even when the "type" attribute was NOT specified in the mapping

RegisterType ( IType nhibernateType, IEnumerable aliases ) : void
RegisterType ( IType nhibernateType, IEnumerable aliases, GetNullableTypeWithLength ctorLength ) : void
RegisterType ( IType nhibernateType, IEnumerable aliases, GetNullableTypeWithPrecision ctorPrecision ) : void
RegisterType ( System systemType, IType nhibernateType, IEnumerable aliases ) : void
RegisterType ( System systemType, IType nhibernateType, IEnumerable aliases, GetNullableTypeWithLength ctorLength ) : void
RegisterType ( System systemType, IType nhibernateType, IEnumerable aliases, GetNullableTypeWithPrecision ctorPrecision ) : void
TypeFactory ( ) : System

Описание методов

Array() публичный статический Метод

public static Array ( string role, string propertyRef, bool embedded, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
embedded bool
elementClass System
Результат NHibernate.Type.CollectionType

Basic() публичный статический Метод

Given the name of a Hibernate type such as Decimal, Decimal(19,0) , Int32, or even NHibernate.Type.DecimalType, NHibernate.Type.DecimalType(19,0), NHibernate.Type.Int32Type, then return an instance of NHibernate.Type.IType
This method will return null if the name is not found in the basicNameMap.
public static Basic ( string name ) : IType
name string The name of the type.
Результат IType

CustomCollection() публичный статический Метод

public static CustomCollection ( string typeName, string>.IDictionary typeParameters, string role, string propertyRef, bool embedded ) : NHibernate.Type.CollectionType
typeName string
typeParameters string>.IDictionary
role string
propertyRef string
embedded bool
Результат NHibernate.Type.CollectionType

GenericBag() публичный статический Метод

public static GenericBag ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
elementClass System
Результат NHibernate.Type.CollectionType

GenericIdBag() публичный статический Метод

public static GenericIdBag ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
elementClass System
Результат NHibernate.Type.CollectionType

GenericList() публичный статический Метод

public static GenericList ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
elementClass System
Результат NHibernate.Type.CollectionType

GenericMap() публичный статический Метод

public static GenericMap ( string role, string propertyRef, System indexClass, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
indexClass System
elementClass System
Результат NHibernate.Type.CollectionType

GenericOrderedSet() публичный статический Метод

public static GenericOrderedSet ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
elementClass System
Результат NHibernate.Type.CollectionType

GenericSet() публичный статический Метод

public static GenericSet ( string role, string propertyRef, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
elementClass System
Результат NHibernate.Type.CollectionType

GenericSortedDictionary() публичный статический Метод

public static GenericSortedDictionary ( string role, string propertyRef, object comparer, System indexClass, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
comparer object
indexClass System
elementClass System
Результат NHibernate.Type.CollectionType

GenericSortedList() публичный статический Метод

public static GenericSortedList ( string role, string propertyRef, object comparer, System indexClass, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
comparer object
indexClass System
elementClass System
Результат NHibernate.Type.CollectionType

GenericSortedSet() публичный статический Метод

public static GenericSortedSet ( string role, string propertyRef, object comparer, System elementClass ) : NHibernate.Type.CollectionType
role string
propertyRef string
comparer object
elementClass System
Результат NHibernate.Type.CollectionType

HeuristicType() публичный статический Метод

Uses heuristics to deduce a NHibernate type given a string naming the type.
When looking for the NHibernate type it will look in the cache of the Basic types first. If it doesn't find it in the cache then it uses the typeName to get a reference to the Class (Type in .NET). Once we get the reference to the .NET class we check to see if it implements IType, ICompositeUserType, IUserType, ILifecycle (Association), or IPersistentEnum. If none of those are implemented then we will serialize the Type to the database using NHibernate.Type.SerializableType(typeName)
public static HeuristicType ( string typeName ) : IType
typeName string
Результат IType

HeuristicType() публичный статический Метод

Uses heuristics to deduce a NHibernate type given a string naming the type.
public static HeuristicType ( string typeName, string>.IDictionary parameters ) : IType
typeName string the type name
parameters string>.IDictionary parameters for the type
Результат IType

HeuristicType() публичный статический Метод

Uses heuristics to deduce a NHibernate type given a string naming the type.
public static HeuristicType ( string typeName, string>.IDictionary parameters, int length ) : IType
typeName string the type name
parameters string>.IDictionary parameters for the type
length int optionally, the size of the type
Результат IType

InjectParameters() публичный статический Метод

public static InjectParameters ( Object type, string>.IDictionary parameters ) : void
type Object
parameters string>.IDictionary
Результат void

ManyToOne() публичный статический Метод

A many-to-one association type for the given class and cascade style.
public static ManyToOne ( string persistentClass ) : EntityType
persistentClass string
Результат EntityType

ManyToOne() публичный статический Метод

A many-to-one association type for the given class and cascade style.
public static ManyToOne ( string persistentClass, bool lazy ) : EntityType
persistentClass string
lazy bool
Результат EntityType

ManyToOne() публичный статический Метод

A many-to-one association type for the given class and cascade style.
public static ManyToOne ( string persistentClass, string uniqueKeyPropertyName, bool lazy, bool unwrapProxy, bool isEmbeddedInXML, bool ignoreNotFound, bool isLogicalOneToOne ) : EntityType
persistentClass string
uniqueKeyPropertyName string
lazy bool
unwrapProxy bool
isEmbeddedInXML bool
ignoreNotFound bool
isLogicalOneToOne bool
Результат EntityType

OneToOne() публичный статический Метод

A one-to-one association type for the given class and cascade style.
public static OneToOne ( string persistentClass, ForeignKeyDirection foreignKeyType, string uniqueKeyPropertyName, bool lazy, bool unwrapProxy, bool isEmbeddedInXML, string entityName, string propertyName ) : EntityType
persistentClass string
foreignKeyType ForeignKeyDirection
uniqueKeyPropertyName string
lazy bool
unwrapProxy bool
isEmbeddedInXML bool
entityName string
propertyName string
Результат EntityType