@@ -33,14 +33,15 @@ public static void CommandExecution(ILogger log, FbCommand command)
3333 return ;
3434 }
3535
36- if ( ! FbLogManager . IsParameterLoggingEnabled || ! command . HasParameters )
36+ if ( FbLogManager . IsParameterLoggingEnabled && command . HasParameters )
37+ {
38+ var parameters = FbParameterCollectionToDictionary ( command . Parameters ) ;
39+ log . LogDebug ( "Command execution: {command}, {parameters}" , command . CommandText , parameters ) ;
40+ }
41+ else
3742 {
3843 log . LogDebug ( "Command execution: {command}" , command . CommandText ) ;
39- return ;
4044 }
41-
42- var parameters = FbParameterCollectionToDictionary ( command . Parameters ) ;
43- log . LogDebug ( "Command execution: {command}, {parameters}" , command . CommandText , parameters ) ;
4445 }
4546
4647 public static void CommandExecution ( ILogger log , FbBatchCommand command )
@@ -50,14 +51,15 @@ public static void CommandExecution(ILogger log, FbBatchCommand command)
5051 return ;
5152 }
5253
53- if ( ! FbLogManager . IsParameterLoggingEnabled || ! command . HasParameters )
54+ if ( FbLogManager . IsParameterLoggingEnabled && command . HasParameters )
55+ {
56+ var parameters = command . BatchParameters . SelectMany ( FbParameterCollectionToDictionary ) ;
57+ log . LogDebug ( "Command execution: {command}, {parameters}" , command . CommandText , parameters ) ;
58+ }
59+ else
5460 {
5561 log . LogDebug ( "Command execution: {command}" , command . CommandText ) ;
56- return ;
5762 }
58-
59- var parameters = command . BatchParameters . SelectMany ( FbParameterCollectionToDictionary ) ;
60- log . LogDebug ( "Command execution: {command}, {parameters}" , command . CommandText , parameters ) ;
6163 }
6264
6365 public static void ConnectionOpening ( ILogger log , FbConnection connection ) =>
@@ -129,7 +131,6 @@ private static object NormalizeDbNull(object value) =>
129131 private static Dictionary < string , object > FbParameterCollectionToDictionary ( FbParameterCollection parameters ) =>
130132 parameters
131133 . Cast < DbParameter > ( )
132- . ToList ( )
133134 . ToDictionary (
134135 p => p . ParameterName ,
135136 p => NormalizeDbNull ( p . Value )
0 commit comments