本文整理汇总了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);
}
示例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;
}
示例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);
}
}