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


C# IUnitOfWork.ExecuteResultsets方法代码示例

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

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


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