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


C# IExpectation.VerifyOutcomeNonBatched方法代码示例

本文整理汇总了C#中IExpectation.VerifyOutcomeNonBatched方法的典型用法代码示例。如果您正苦于以下问题:C# IExpectation.VerifyOutcomeNonBatched方法的具体用法?C# IExpectation.VerifyOutcomeNonBatched怎么用?C# IExpectation.VerifyOutcomeNonBatched使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IExpectation的用法示例。


在下文中一共展示了IExpectation.VerifyOutcomeNonBatched方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddToBatch

		/// <summary>
		/// Executes the current <see cref="IDbCommand"/> and compares the row Count
		/// to the <c>expectedRowCount</c>.
		/// </summary>
		/// <param name="expectation">
		/// The expected number of rows affected by the query.  A value of less than <c>0</c>
		/// indicates that the number of rows to expect is unknown or should not be a factor.
		/// </param>
		/// <exception cref="HibernateException">
		/// Thrown when there is an expected number of rows to be affected and the
		/// actual number of rows is different.
		/// </exception>
		public override void AddToBatch(IExpectation expectation)
		{
			IDbCommand cmd = CurrentCommand;
			Driver.AdjustCommand(cmd);
			int rowCount = ExecuteNonQuery(cmd);
			expectation.VerifyOutcomeNonBatched(rowCount, cmd);
		}
开发者ID:hoangduc007,项目名称:nhibernate-core,代码行数:19,代码来源:NonBatchingBatcher.cs

示例2: Check

		protected bool Check(int rows, object id, int tableNumber, IExpectation expectation, IDbCommand statement)
		{
			try
			{
				expectation.VerifyOutcomeNonBatched(rows, statement);
			}
			catch (StaleStateException)
			{
				if (!IsNullableTable(tableNumber))
				{
					if (Factory.Statistics.IsStatisticsEnabled)
						Factory.StatisticsImplementor.OptimisticFailure(EntityName);

					throw new StaleObjectStateException(EntityName, id);
				}
			}
			catch (TooManyRowsAffectedException ex)
			{
				throw new HibernateException("Duplicate identifier in table for: " + MessageHelper.InfoString(this, id, Factory), ex);
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:26,代码来源:AbstractEntityPersister.cs

示例3: PerformInsert

		protected object PerformInsert(object ownerId, IPersistentCollection collection, IExpectation expectation,
		                               object entry, int index, bool useBatch, bool callable, ISessionImplementor session)
		{
			object entryId = null;
			int offset = 0;
			IDbCommand st = useBatch
			                	? session.Batcher.PrepareBatchCommand(SqlInsertRowString.CommandType, SqlInsertRowString.Text,
			                	                                      SqlInsertRowString.ParameterTypes)
			                	: session.Batcher.PrepareCommand(SqlInsertRowString.CommandType, SqlInsertRowString.Text,
			                	                                 SqlInsertRowString.ParameterTypes);
			try
			{
				//offset += expectation.Prepare(st, factory.ConnectionProvider.Driver);
				offset = WriteKey(st, ownerId, offset, session);
				if (hasIdentifier)
				{
					entryId = collection.GetIdentifier(entry, index);
					offset = WriteIdentifier(st, entryId, offset, session);
				}
				if (hasIndex)
				{
					offset = WriteIndex(st, collection.GetIndex(entry, index, this), offset, session);
				}
				WriteElement(st, collection.GetElement(entry), offset, session);
				if (useBatch)
				{
					session.Batcher.AddToBatch(expectation);
				}
				else
				{
					expectation.VerifyOutcomeNonBatched(session.Batcher.ExecuteNonQuery(st), st);
				}
			}
			catch (Exception e)
			{
				if (useBatch)
				{
					session.Batcher.AbortBatch(e);
				}
				throw;
			}
			finally
			{
				if (!useBatch)
				{
					session.Batcher.CloseCommand(st, null);
				}
			}
			return entryId;
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:50,代码来源:AbstractCollectionPersister.cs

示例4: Check

		protected void Check(int rows, object id, int tableNumber, IExpectation expectation, IDbCommand statement)
		{
			try
			{
				expectation.VerifyOutcomeNonBatched(rows, statement);
			}
			catch (StaleStateException)
			{
				// TODO H3: if (!IsNullableTable(tableNumber))
				throw new StaleObjectStateException(MappedClass, id);
			}
			catch (TooManyRowsAffectedException ex)
			{
				throw new HibernateException(
					"Duplicate identifier in table for: " +
					MessageHelper.InfoString(this, id, Factory),
					ex);
			}
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:19,代码来源:AbstractEntityPersister.cs


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