本文整理汇总了C#中IUnitOfWork.CreateParameter方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.CreateParameter方法的具体用法?C# IUnitOfWork.CreateParameter怎么用?C# IUnitOfWork.CreateParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.CreateParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: GetDbDataParameters
public IEnumerable<DbParameter> GetDbDataParameters(IUnitOfWork unitOfWork)
{
List<DbParameter> dbParameters;
DbParameter dbDataParameter;
if ((object)unitOfWork == null)
throw new ArgumentNullException(nameof(unitOfWork));
dbParameters = new List<DbParameter>();
foreach (AdoNetParameterConfiguration adoNetParameterConfiguration in this.AdoNetParameterConfigurations)
{
dbDataParameter = unitOfWork.CreateParameter(adoNetParameterConfiguration.SourceColumn, adoNetParameterConfiguration.ParameterDirection, adoNetParameterConfiguration.ParameterDbType, adoNetParameterConfiguration.ParameterSize, adoNetParameterConfiguration.ParameterPrecision, adoNetParameterConfiguration.ParameterScale, adoNetParameterConfiguration.ParameterNullable, adoNetParameterConfiguration.ParameterName, adoNetParameterConfiguration.ParameterValue);
dbParameters.Add(dbDataParameter);
}
return dbParameters.ToArray();
}
示例3: GetDbParameters
public IEnumerable<DbParameter> GetDbParameters(IUnitOfWork unitOfWork)
{
List<DbParameter> dbParameters;
DbParameter dbParameter;
if ((object)unitOfWork == null)
throw new ArgumentNullException(nameof(unitOfWork));
dbParameters = new List<DbParameter>();
foreach (ITacticParameter tacticParameter in this.TacticParameters)
{
dbParameter = unitOfWork.CreateParameter(tacticParameter.ParameterDirection, tacticParameter.ParameterDbType, tacticParameter.ParameterSize, tacticParameter.ParameterPrecision, tacticParameter.ParameterScale, tacticParameter.ParameterNullable, tacticParameter.ParameterName, tacticParameter.ParameterValue);
dbParameters.Add(dbParameter);
}
return dbParameters.ToArray();
}