當前位置: 首頁>>代碼示例>>C#>>正文


C# ChangeTrackingService.BeginAtomicOperation方法代碼示例

本文整理匯總了C#中Topics.Radical.ChangeTracking.ChangeTrackingService.BeginAtomicOperation方法的典型用法代碼示例。如果您正苦於以下問題:C# ChangeTrackingService.BeginAtomicOperation方法的具體用法?C# ChangeTrackingService.BeginAtomicOperation怎麽用?C# ChangeTrackingService.BeginAtomicOperation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Topics.Radical.ChangeTracking.ChangeTrackingService的用法示例。


在下文中一共展示了ChangeTrackingService.BeginAtomicOperation方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: changeTrackingService_beginAtomicOperation_normal_should_create_valid_atomic_operation

		public void changeTrackingService_beginAtomicOperation_normal_should_create_valid_atomic_operation()
		{
			var target = new ChangeTrackingService();
			var actual = target.BeginAtomicOperation();

			actual.Should().Not.Be.Null();
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:7,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例2: changeTrackingService_using_atomicOperation_after_operation_complete_entityState_should_be_changed

		public void changeTrackingService_using_atomicOperation_after_operation_complete_entityState_should_be_changed()
		{
			var target = new ChangeTrackingService();

			var person = new Person( target );

			target.AcceptChanges();
			
			using( var op = target.BeginAtomicOperation() )
			{
				person.Name = "Mauro";

				op.Complete();
			}

			var state = target.GetEntityState( person );

			var actual = (state & EntityTrackingStates.HasBackwardChanges ) == EntityTrackingStates.HasBackwardChanges;
			actual.Should().Be.True();
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:20,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例3: changeTrackingService_using_beginAtomicOperation_should_set_is_changed_only_on_operation_completed

		public void changeTrackingService_using_beginAtomicOperation_should_set_is_changed_only_on_operation_completed()
		{
			var target = new ChangeTrackingService();

			var person = new Person( target );
			var list = new PersonCollection( target );

			using( var actual = target.BeginAtomicOperation() )
			{
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				target.IsChanged.Should().Be.False();

				actual.Complete();
			}

			target.IsChanged.Should().Be.True();
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:20,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例4: changeTrackingService_using_beginAtomicOperation_should_fully_rollback_on_single_undo

		public void changeTrackingService_using_beginAtomicOperation_should_fully_rollback_on_single_undo()
		{
			var target = new ChangeTrackingService();

			var person = new Person( target );
			var list = new PersonCollection( target );

			using( var actual = target.BeginAtomicOperation() )
			{
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				actual.Complete();
			}

			target.Undo();

			list.Count.Should().Be.EqualTo( 0 );
			person.Name.Should().Be.EqualTo( String.Empty );
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:21,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例5: changeTrackingService_using_beginAtomicOperation_redo_should_reapply_all_changes_with_one_pass

		public void changeTrackingService_using_beginAtomicOperation_redo_should_reapply_all_changes_with_one_pass()
		{
			var target = new ChangeTrackingService();

			var person = new Person( target );
			var list = new PersonCollection( target );

			using( var actual = target.BeginAtomicOperation() )
			{
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				actual.Complete();
			}

			target.Undo();
			target.Redo();

			list.Count.Should().Be.EqualTo( 1 );
			person.Name.Should().Be.EqualTo( "Mauro Servienti" );
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:22,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例6: ChangeTrackingService

		public void changeTrackingService_using_beginAtomicOperation_hasTransientEntities_should_return_true_even_for_entities_created_in_the_atomic_operation()
		{
			var target = new ChangeTrackingService();

			var list = new PersonCollection( target );
			var person = new Person( target, false );

			using( var op = target.BeginAtomicOperation() )
			{
				target.RegisterTransient( person );
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				op.Complete();
			}

			var actual = target.HasTransientEntities;

			actual.Should().Be.True();
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:21,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例7: changeTrackingService_using_beginAtomicOperation_getEntities_should_return_all_transient_entities

		public void changeTrackingService_using_beginAtomicOperation_getEntities_should_return_all_transient_entities()
		{
			var target = new ChangeTrackingService();

			var list = new PersonCollection( target );
			var person = new Person( target, false );

			using( var op = target.BeginAtomicOperation() )
			{
				target.RegisterTransient( person );
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				op.Complete();
			}

			var actual = target.GetEntities( EntityTrackingStates.IsTransient, false );

			actual.Contains( person ).Should().Be.True();
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:21,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例8: changeTrackingService_using_beginAtomicOperation_getEntities_should_return_all_changed_entities

		public void changeTrackingService_using_beginAtomicOperation_getEntities_should_return_all_changed_entities()
		{
			var target = new ChangeTrackingService();

			var person = new Person( target );
			var list = new PersonCollection( target );

			using( var op = target.BeginAtomicOperation() )
			{
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				op.Complete();
			}

			var actual = target.GetEntities( EntityTrackingStates.HasBackwardChanges, false );

			/*
			 * Non funziona perchè non funziona GetEntityState()
			 */

			actual.Contains( person ).Should().Be.True();
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:24,代碼來源:AtomicChangesChangeTrackingServiceTests.cs

示例9: changeTrackingService_using_beginAtomicOperation_getEntityState_should_return_valid_entity_state

		public void changeTrackingService_using_beginAtomicOperation_getEntityState_should_return_valid_entity_state()
		{
			var target = new ChangeTrackingService();

			var person = new Person( target );
			var list = new PersonCollection( target );

			using( var op = target.BeginAtomicOperation() )
			{
				person.Name = "Mauro";
				list.Add( person );
				person.Name = "Mauro Servienti";

				op.Complete();
			}

			var actual = target.GetEntityState( person );
			actual.Should().Be.EqualTo( EntityTrackingStates.HasBackwardChanges | EntityTrackingStates.IsTransient | EntityTrackingStates.AutoRemove );
		}
開發者ID:nazarenomanco,項目名稱:Radical,代碼行數:19,代碼來源:AtomicChangesChangeTrackingServiceTests.cs


注:本文中的Topics.Radical.ChangeTracking.ChangeTrackingService.BeginAtomicOperation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。