@@ -34,8 +34,9 @@ private enum TypeClassification
3434 PrecisionScale
3535 }
3636
37+ public static readonly string [ ] EmptyAliases = new string [ 0 ] ;
38+
3739 private static readonly INHibernateLogger _log = NHibernateLogger . For ( typeof ( TypeFactory ) ) ;
38- private static readonly string [ ] EmptyAliases = new string [ 0 ] ;
3940 private static readonly char [ ] PrecisionScaleSplit = { '(' , ')' , ',' } ;
4041 private static readonly char [ ] LengthSplit = { '(' , ')' } ;
4142
@@ -96,7 +97,15 @@ private enum TypeClassification
9697
9798 private delegate NullableType NullableTypeCreatorDelegate ( SqlType sqlType ) ;
9899
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 )
100109 {
101110 var typeAliases = new List < string > ( aliases ) ;
102111 typeAliases . AddRange ( GetClrTypeAliases ( systemType ) ) ;
@@ -314,25 +323,6 @@ private static void RegisterBuiltInTypes()
314323 len => new SerializableType ( typeof ( object ) , SqlTypeFactory . GetBinary ( len ) ) ) ) ;
315324 }
316325
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-
336326 private static ICollectionTypeFactory CollectionTypeFactory =>
337327 Environment . BytecodeProvider . CollectionTypeFactory ;
338328
0 commit comments