当前位置: 首页>>代码示例>>C#>>正文


C# IUnitOfWork.CreateParameter方法代码示例

本文整理汇总了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);
        }
开发者ID:alistairwalsh,项目名称:main,代码行数:45,代码来源:RecordCommandAdoNetDestinationAdapter.cs

示例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();
		}
开发者ID:textmetal,项目名称:main,代码行数:18,代码来源:AdoNetCommandConfiguration.cs

示例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();
		}
开发者ID:textmetal,项目名称:main,代码行数:18,代码来源:TacticCommand.cs


注:本文中的IUnitOfWork.CreateParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。