File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed
src/NHibernate/Cfg/XmlHbmBinding Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change 1+ using System ;
12using System . Linq ;
3+ using NHibernate . Mapping ;
4+ using NHibernate . Type ;
25
36
47namespace NHibernate . Cfg . XmlHbmBinding
58{
69 public static class MappingLogExtensions
710 {
8- public static void LogMapped ( this Mapping . Property property , IInternalLogger log )
11+ public static void LogMapped ( this Property property , IInternalLogger log )
912 {
1013 if ( log . IsDebugEnabled )
1114 {
12- string msg = "Mapped property: " + property . Name ;
13- string columns = string . Join ( "," , property . Value . ColumnIterator . Select ( c => c . Text ) . ToArray ( ) ) ;
15+ var msg = "Mapped property: " + property . Name ;
16+ var columns = string . Join ( "," , property . Value . ColumnIterator . Select ( c => c . Text ) . ToArray ( ) ) ;
1417 if ( columns . Length > 0 )
1518 msg += " -> " + columns ;
16- if ( property . Type != null )
17- msg += ", type: " + property . Type . Name ;
19+ var propertyTypeName = SafeGetPropertyTypeName ( property ) ;
20+ if ( propertyTypeName != null )
21+ msg += ", type: " + propertyTypeName ;
1822 log . Debug ( msg ) ;
1923 }
2024 }
25+
26+ static string SafeGetPropertyTypeName ( Property property )
27+ {
28+ try
29+ {
30+ //property.Type property can trigger a type load
31+ if ( property . Type != null ) return property . Type . Name ;
32+ }
33+ catch ( Exception )
34+ {
35+ return "<could not load type>" ;
36+ }
37+ return null ;
38+ }
2139 }
22- }
40+ }
You can’t perform that action at this time.
0 commit comments