本文整理汇总了C#中Transaction.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.Remove方法的具体用法?C# Transaction.Remove怎么用?C# Transaction.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestTransaction
public void TestTransaction()
{
// create some variables to work with
l1 = MailingList.Retrieve( 1 ); // reuse existing list
Member member = new Member( l1.Id, "Trans", "[email protected]" );
// create and populate the transaction
Transaction t = new Transaction();
t.Update( l1 );
t.Persist( member );
t.Commit();
// try updates and deletes
member.Name = "Action";
t = new Transaction();
t.Update( member );
t.Remove( member );
t.Commit();
}
示例2: Remove
/// <summary>
/// Remove the current instance from the database.
/// </summary>
/// <param name="transaction">The transaction in which to execute the operation.</param>
public virtual void Remove( Transaction transaction )
{
if( ! isPersisted )
{
Check.Fail( Error.DeveloperError, "Unable to remove objects that have not yet been persisted." );
}
transaction.Remove( this );
}
示例3: Remove
/// <summary>
/// Remove the current instance from the database.
/// </summary>
/// <param name="transaction">The transaction in which to execute the operation.</param>
public virtual void Remove( Transaction transaction )
{
if( ! isPersisted )
{
Check.Fail( Error.DeveloperError, "Unable to remove objects that have not yet been persisted." );
}
Check.VerifyNotNull( transaction, Error.NullParameter, "transaction" );
transaction.Remove( this );
}
示例4: Remove
/// <summary>
/// Remove an object from the list. For 1:n relations, if the object is persisted it will also
/// be removed from the database. For n:m relations, the relation object is removed (the object
/// being removed is left untouched and must manually be removed if so desired).
/// </summary>
/// <param name="transaction">The transaction within which to execute statements.</param>
/// <param name="value">The object to remove from the list</param>
public virtual void Remove( Transaction transaction, object value )
{
object val = Find( Key.GetKey( broker, false, value ) );
value = val ?? value;
if( Contains( value ) )
{
Check.VerifyNotNull( value, Error.NullParameter, "value" );
Check.Verify( containedMap.Type.Equals( value.GetType() ) ||
value.GetType().IsSubclassOf( containedMap.Type ),
Error.UnsupportedType, value.GetType() );
// call remove even if contains was false to make sure error reporting is unchanged
// Note: calling ArrayList/base class RemoveAt seems to work but calling Remove does
// not - calling base.Remove ends up here again - must be a bug in net-1.1.
base.RemoveAt( IndexOf( value ) );
if( viaInstances == null )
{
// manage removed object
IPersistent obj = value as IPersistent;
if( obj.IsPersisted )
{
if( transaction != null )
{
transaction.Remove( obj );
}
else
{
obj.Remove();
}
}
}
else
{
// manage n:m relation object
viaInstances.Remove( transaction, value );
}
}
}