SqlClientBatchingBatcher doesn't work with MicrosoftDataSqlClientDriver #3258
-
|
When using the There's specificaly code that expects that the SqlCommand will be Is there some way to work around this? Can this be fixed, please? Specific line: https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs#L67 See public override void AddToBatch(IExpectation expectation)
{
_totalExpectedRowsAffected += expectation.ExpectedRowCount;
var batchUpdate = CurrentCommand;
Driver.AdjustCommand(batchUpdate);
string lineWithParameters = null;
var sqlStatementLogger = Factory.Settings.SqlStatementLogger;
if (sqlStatementLogger.IsDebugEnabled || Log.IsDebugEnabled())
{
lineWithParameters = sqlStatementLogger.GetCommandLineWithParameters(batchUpdate);
var formatStyle = sqlStatementLogger.DetermineActualStyle(FormatStyle.Basic);
lineWithParameters = formatStyle.Formatter.Format(lineWithParameters);
_currentBatchCommandsLog.Append("command ")
.Append(_currentBatch.CountOfCommands)
.Append(":")
.AppendLine(lineWithParameters);
}
if (Log.IsDebugEnabled())
{
Log.Debug("Adding to batch:{0}", lineWithParameters);
}
_currentBatch.Append((System.Data.SqlClient.SqlCommand) Driver.UnwrapDbCommand(batchUpdate));
if (_currentBatch.CountOfCommands >= _batchSize)
{
ExecuteBatchWithTiming(batchUpdate);
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
|
This batcher is implemented through an internal batcher provided by For |
Beta Was this translation helpful? Give feedback.
-
|
I think it's possible to create a new Why do you think it cannot work? Should I prepare a PR to demonstrate?
I'm in the process of migrating a big application from |
Beta Was this translation helpful? Give feedback.
SqlClientBatchingBatcherusesSystem.Data.SqlClient, it cannot work withMicrosoft.Data.SqlClient.This batcher is implemented through an internal batcher provided by
System.Data.SqlClient, see here.For
Microsoft.Data.SqlClient, use the generic batching batcher. (Just leave it un-configured, the driver will use it by default, see here.)