@@ -33,8 +33,8 @@ private enum TypeClassification
3333 Length ,
3434 PrecisionScale
3535 }
36-
37- private static readonly string [ ] EmptyAliases = new string [ 0 ] ;
36+
37+ public static readonly string [ ] EmptyAliases = new string [ 0 ] ;
3838 private static readonly char [ ] PrecisionScaleSplit = { '(' , ')' , ',' } ;
3939 private static readonly char [ ] LengthSplit = { '(' , ')' } ;
4040
@@ -92,7 +92,15 @@ private enum TypeClassification
9292
9393 private delegate NullableType NullableTypeCreatorDelegate ( SqlType sqlType ) ;
9494
95- private static void RegisterType ( System . Type systemType , IType nhibernateType , IEnumerable < string > aliases )
95+ /// <summary>
96+ /// <para>Defines which NHibernate type should be chosen by default for handling a given .Net type.</para>
97+ /// <para>This must be done before any operation on NHibernate, including building its
98+ /// <see cref="Configuration" /> and building session factory. Otherwise the behavior will be undefined.</para>
99+ /// </summary>
100+ /// <param name="systemType">The .Net type.</param>
101+ /// <param name="nhibernateType">The NHibernate type.</param>
102+ /// <param name="aliases">The additional aliases to map to the type. Use <see cref="EmptyAliases"/> if none.</param>
103+ public static void RegisterType ( System . Type systemType , IType nhibernateType , IEnumerable < string > aliases )
96104 {
97105 var typeAliases = new List < string > ( aliases ) ;
98106 typeAliases . AddRange ( GetClrTypeAliases ( systemType ) ) ;
@@ -280,25 +288,6 @@ private static void RegisterBuiltInTypes()
280288 len => new SerializableType ( typeof ( object ) , SqlTypeFactory . GetBinary ( len ) ) ) ) ;
281289 }
282290
283- /// <summary>
284- /// <para>Defines which NHibernate type should be chosen by default for handling a given .Net type.</para>
285- /// <para>This must be done before any operation on NHibernate, including building its
286- /// <see cref="Configuration" /> and building session factory. Otherwise the behavior will be undefined.</para>
287- /// </summary>
288- /// <param name="targetType">The NHibernate type.</param>
289- /// <typeparam name="T">The .Net type.</typeparam>
290- public static void SetDefaultType < T > ( IType targetType )
291- {
292- if ( targetType == null )
293- throw new ArgumentNullException ( nameof ( targetType ) ) ;
294-
295- var type = typeof ( T ) ;
296- foreach ( var alias in GetClrTypeAliases ( type ) )
297- {
298- typeByTypeOfName [ alias ] = targetType ;
299- }
300- }
301-
302291 private static ICollectionTypeFactory CollectionTypeFactory =>
303292 Environment . BytecodeProvider . CollectionTypeFactory ;
304293
0 commit comments