@@ -34,8 +34,9 @@ private enum TypeClassification
34
34
PrecisionScale
35
35
}
36
36
37
+ public static readonly string [ ] EmptyAliases = System . Array . Empty < string > ( ) ;
38
+
37
39
private static readonly INHibernateLogger _log = NHibernateLogger . For ( typeof ( TypeFactory ) ) ;
38
- private static readonly string [ ] EmptyAliases = System . Array . Empty < string > ( ) ;
39
40
private static readonly char [ ] PrecisionScaleSplit = { '(' , ')' , ',' } ;
40
41
private static readonly char [ ] LengthSplit = { '(' , ')' } ;
41
42
@@ -96,7 +97,15 @@ private enum TypeClassification
96
97
97
98
private delegate NullableType NullableTypeCreatorDelegate ( SqlType sqlType ) ;
98
99
99
- private static void RegisterType ( System . Type systemType , IType nhibernateType , IEnumerable < string > aliases )
100
+ /// <summary>
101
+ /// <para>Defines which NHibernate type should be chosen by default for handling a given .Net type.</para>
102
+ /// <para>This must be done before any operation on NHibernate, including building its
103
+ /// <see cref="Configuration" /> and building session factory. Otherwise the behavior will be undefined.</para>
104
+ /// </summary>
105
+ /// <param name="systemType">The .Net type.</param>
106
+ /// <param name="nhibernateType">The NHibernate type.</param>
107
+ /// <param name="aliases">The additional aliases to map to the type. Use <see cref="EmptyAliases"/> if none.</param>
108
+ public static void RegisterType ( System . Type systemType , IType nhibernateType , IEnumerable < string > aliases )
100
109
{
101
110
var typeAliases = new List < string > ( aliases ) ;
102
111
typeAliases . AddRange ( GetClrTypeAliases ( systemType ) ) ;
@@ -314,25 +323,6 @@ private static void RegisterBuiltInTypes()
314
323
len => new SerializableType ( typeof ( object ) , SqlTypeFactory . GetBinary ( len ) ) ) ) ;
315
324
}
316
325
317
- /// <summary>
318
- /// <para>Defines which NHibernate type should be chosen by default for handling a given .Net type.</para>
319
- /// <para>This must be done before any operation on NHibernate, including building its
320
- /// <see cref="Configuration" /> and building session factory. Otherwise the behavior will be undefined.</para>
321
- /// </summary>
322
- /// <param name="targetType">The NHibernate type.</param>
323
- /// <typeparam name="T">The .Net type.</typeparam>
324
- public static void SetDefaultType < T > ( IType targetType )
325
- {
326
- if ( targetType == null )
327
- throw new ArgumentNullException ( nameof ( targetType ) ) ;
328
-
329
- var type = typeof ( T ) ;
330
- foreach ( var alias in GetClrTypeAliases ( type ) )
331
- {
332
- typeByTypeOfName [ alias ] = targetType ;
333
- }
334
- }
335
-
336
326
private static ICollectionTypeFactory CollectionTypeFactory =>
337
327
Environment . BytecodeProvider . CollectionTypeFactory ;
338
328
0 commit comments