@@ -29,7 +29,9 @@ public partial class Session
2929
3030 internal void Invalidate ( )
3131 {
32- OrmLog . Debug ( Strings . LogSessionXInvalidate , this ) ;
32+ if ( IsDebugEventLoggingEnabled ) {
33+ OrmLog . Debug ( Strings . LogSessionXInvalidate , this ) ;
34+ }
3335
3436 ClearChangeRegistry ( ) ;
3537 InvalidateCachedEntities ( ) ;
@@ -65,7 +67,10 @@ internal void RemapEntityKeys(KeyMapping keyMapping)
6567 Persist ( PersistReason . RemapEntityKeys ) ;
6668 Invalidate ( ) ;
6769 }
68- OrmLog . Debug ( Strings . LogSessionXRemappingEntityKeys , this ) ;
70+ if ( IsDebugEventLoggingEnabled ) {
71+ OrmLog . Debug ( Strings . LogSessionXRemappingEntityKeys , this ) ;
72+ }
73+
6974 foreach ( var entityState in EntityChangeRegistry . GetItems ( PersistenceState . New ) ) {
7075 var key = entityState . Key ;
7176 var remappedKey = keyMapping . TryRemapKey ( key ) ;
@@ -119,8 +124,9 @@ internal void RemoveOrCreateRemovedEntity(Type type, Key key)
119124 } ;
120125 EntityStateCache . Add ( result ) ;
121126
122- OrmLog . Debug ( Strings . LogSessionXCachingY , this , result ) ;
123- return ;
127+ if ( IsDebugEventLoggingEnabled ) {
128+ OrmLog . Debug ( Strings . LogSessionXCachingY , this , result ) ;
129+ }
124130 }
125131
126132 internal void InitializeEntity ( Entity entity , bool materialize )
@@ -164,7 +170,10 @@ internal EntityState CreateEntityState(Key key, bool failIfStateIsAlreadyBound)
164170 result . PersistenceState = PersistenceState . New ;
165171 }
166172
167- OrmLog . Debug ( Strings . LogSessionXCachingY , this , result ) ;
173+ if ( IsDebugEventLoggingEnabled ) {
174+ OrmLog . Debug ( Strings . LogSessionXCachingY , this , result ) ;
175+ }
176+
168177 return result ;
169178 }
170179
@@ -212,7 +221,9 @@ internal EntityState UpdateStateInCache(Key key, Tuple tuple, bool isStale)
212221 }
213222 result . Update ( tuple ) ;
214223 result . IsStale = isStale ;
215- OrmLog . Debug ( Strings . LogSessionXUpdatingCacheY , this , result ) ;
224+ if ( IsDebugEventLoggingEnabled ) {
225+ OrmLog . Debug ( Strings . LogSessionXUpdatingCacheY , this , result ) ;
226+ }
216227 }
217228 return result ;
218229 }
@@ -246,7 +257,10 @@ private EntityState AddEntityStateToCache(Key key, Tuple tuple, bool isStale)
246257 PersistenceState = PersistenceState . Synchronized
247258 } ;
248259 EntityStateCache . Add ( result ) ;
249- OrmLog . Debug ( Strings . LogSessionXCachingY , this , result ) ;
260+ if ( IsDebugEventLoggingEnabled ) {
261+ OrmLog . Debug ( Strings . LogSessionXCachingY , this , result ) ;
262+ }
263+
250264 return result ;
251265 }
252266
0 commit comments