We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to log the command and the parameter names and values.
example:
DynamicParameters parameters = new DynamicParameters(new { DistribCode = distributorCode, YardCode = string.Empty, IncludeInactive = includeInactive }); const string sp = "[brcSP_GetInvnDistributorsAndProductionYards]"; _brcConnection.WriteDapperSQLLog(sp, parameters); //____________________ WriteDapperSQLLog below StringBuilder logBuilder = new StringBuilder(); if (Transaction.Current != null) { logBuilder.Append("IN TRANSACTION!!!"); } logBuilder.Append($"exec {storedProc}{Environment.NewLine}"); if (param != null) { int index = 0; if (typeof(DynamicParameters) == param.GetType()) { DynamicParameters parameters = param as DynamicParameters; foreach (string name in parameters.ParameterNames) { dynamic value = parameters.Get<dynamic>(name); logBuilder.Append($" @{name} = {value?.ToString() ?? string.Empty}{((index++ == parameters.ParameterNames.Count() - 1) ? string.Empty : ",")}{Environment.NewLine}"); } } else
ParameterNames is 0 length.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am trying to log the command and the parameter names and values.
example:
ParameterNames is 0 length.
The text was updated successfully, but these errors were encountered: