本文整理汇总了C#中IUnitOfWork.ExecuteResultsets方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.ExecuteResultsets方法的具体用法?C# IUnitOfWork.ExecuteResultsets怎么用?C# IUnitOfWork.ExecuteResultsets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.ExecuteResultsets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CorePublishImpl
protected override void CorePublishImpl(TableConfiguration configuration, IUnitOfWork destinationUnitOfWork, DbDataReader sourceDataReader, out long rowsCopied)
{
IEnumerable<IResultset> resultsets;
IEnumerable<DbParameter> dbParameters;
long _rowsCopied = 0;
if ((object)configuration == null)
throw new ArgumentNullException(nameof(configuration));
if ((object)destinationUnitOfWork == null)
throw new ArgumentNullException(nameof(destinationUnitOfWork));
if ((object)sourceDataReader == null)
throw new ArgumentNullException(nameof(sourceDataReader));
if ((object)this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand == null)
throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", nameof(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand)));
if (SolderLegacyInstanceAccessor.DataTypeFascadeLegacyInstance.IsNullOrWhiteSpace(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand.CommandText))
throw new InvalidOperationException(string.Format("Configuration missing: '{0}.{1}'.", nameof(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand), nameof(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand.CommandText)));
while (sourceDataReader.Read())
{
dbParameters = this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand.GetDbDataParameters(destinationUnitOfWork);
dbParameters = dbParameters.Select(p =>
{
// prevent modified closure bug
var _sourceDataReader = sourceDataReader;
// lazy load
p.Value = _sourceDataReader[p.SourceColumn];
return p;
});
resultsets = destinationUnitOfWork.ExecuteResultsets(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand.CommandType ?? CommandType.Text,
this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommand.CommandText,
dbParameters);
resultsets.ToArray();
_rowsCopied++;
}
rowsCopied = _rowsCopied;
Console.WriteLine("DESTINATION (update): rowsCopied={0}", rowsCopied);
}
示例2: CorePublishImpl
protected override void CorePublishImpl(TableConfiguration configuration, IUnitOfWork destinationUnitOfWork, IDataReader sourceDataReader, out long rowsCopied)
{
IEnumerable<IResultset> resultsets;
long _rowsCopied = 0;
if ((object)configuration == null)
throw new ArgumentNullException("configuration");
if ((object)destinationUnitOfWork == null)
throw new ArgumentNullException("destinationUnitOfWork");
if ((object)sourceDataReader == null)
throw new ArgumentNullException("sourceDataReader");
if (DataTypeFascade.Instance.IsNullOrWhiteSpace(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommandText))
throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", "ExecuteCommandText"));
// ?
{
IDbDataParameter commandParameter;
IDictionary<string, IDbDataParameter> commandParameters;
commandParameters = new Dictionary<string, IDbDataParameter>();
while (sourceDataReader.Read())
{
commandParameters.Clear();
foreach (ColumnConfiguration columnConfiguration in configuration.ColumnConfigurations)
{
commandParameter = destinationUnitOfWork.CreateParameter(ParameterDirection.Input, DbType.AnsiString, 0, 0, 0, true, string.Format("@{0}", columnConfiguration.ColumnName), sourceDataReader[columnConfiguration.ColumnName]);
commandParameters.Add(columnConfiguration.ColumnName, commandParameter);
}
resultsets = destinationUnitOfWork.ExecuteResultsets(this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommandType ?? CommandType.Text, this.AdapterConfiguration.AdapterSpecificConfiguration.ExecuteCommandText, commandParameters.Values.ToArray());
resultsets.ToArray();
_rowsCopied++;
}
}
rowsCopied = _rowsCopied;
Console.WriteLine("DESTINATION (update): rowsCopied={0}", rowsCopied);
}