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


C# Transaction.Remove方法代码示例

本文整理汇总了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();
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:17,代码来源:TestList.cs

示例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 );
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:12,代码来源:GuidHolderIP.cs

示例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 );
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:13,代码来源:Persistent.cs

示例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 );
				}
			}
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:44,代码来源:GentleList.cs


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