本文整理汇总了C#中Topics.Radical.ChangeTracking.ChangeTrackingService.GetEntityState方法的典型用法代码示例。如果您正苦于以下问题:C# ChangeTrackingService.GetEntityState方法的具体用法?C# ChangeTrackingService.GetEntityState怎么用?C# ChangeTrackingService.GetEntityState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topics.Radical.ChangeTracking.ChangeTrackingService
的用法示例。
在下文中一共展示了ChangeTrackingService.GetEntityState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: after_add_GetEntityState_is_Changed
public void after_add_GetEntityState_is_Changed()
{
EntityTrackingStates expected = EntityTrackingStates.HasBackwardChanges;
ChangeTrackingService svc = new ChangeTrackingService();
PersonCollection p = new PersonCollection( svc );
p.Add( new Person( svc, false ) );
p.Add( new Person( svc, false ) );
EntityTrackingStates actual = svc.GetEntityState( p );
actual.Should().Be.EqualTo( expected );
}
示例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();
}
示例3: service_on_stopTracking_removes_every_reference_to_entity
public void service_on_stopTracking_removes_every_reference_to_entity()
{
EntityTrackingStates expected = EntityTrackingStates.None;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
p.Name = "Foo";
svc.Detach( p );
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例4: changeTrackingService_getEntityState_using_entity_managed_by_different_service_should_return_None
public void changeTrackingService_getEntityState_using_entity_managed_by_different_service_should_return_None()
{
var expected = EntityTrackingStates.None;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( new ChangeTrackingService(), true );
var actual = svc.GetEntityState( p );
actual.Should().Be.EqualTo( expected );
}
示例5: using
public void entityMemento_ctor_requesting_transient_registration_using_base_iMemento_to_suspended_memento_do_not_register_entity_as_transient()
{
EntityTrackingStates expected = EntityTrackingStates.None;
using( var svc = new ChangeTrackingService() )
{
svc.Suspend();
var target = this.CreateMock( true );
( ( IMemento )target ).Memento = svc;
EntityTrackingStates actual = svc.GetEntityState( target );
actual.Should().Be.EqualTo( expected );
}
}
示例6: 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 );
}
示例7: if_entity_is_iComponent_on_Disposed_entity_is_removed_from_transient
public void if_entity_is_iComponent_on_Disposed_entity_is_removed_from_transient()
{
ChangeTrackingService svc = new ChangeTrackingService();
EntityTrackingStates expected = EntityTrackingStates.None;
Person p = null;
using( p = new Person( svc, false ) )
{
svc.RegisterTransient( p, false );
}
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例8: entity_registeredAsTransient_with_autoRemove_on_Undo_is_transient
public void entity_registeredAsTransient_with_autoRemove_on_Undo_is_transient()
{
ChangeTrackingService svc = new ChangeTrackingService();
EntityTrackingStates expected = EntityTrackingStates.IsTransient | EntityTrackingStates.AutoRemove;
Person p = new Person( svc );
svc.Undo();
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例9: ChangeTrackingService
public void changeTrackingService_revert_normal_entity_registered_transient_with_no_autoRemove_and_changes_before_bookmark_creation_should_remain_transient()
{
var expected = EntityTrackingStates.IsTransient | EntityTrackingStates.HasBackwardChanges;
var memento = new ChangeTrackingService();
var person = new Person( memento, false );
memento.RegisterTransient( person, false );
person.Name = "Mauro";
var bookmark = memento.CreateBookmark();
new Person( memento, true );
memento.Revert( bookmark );
var actual = memento.GetEntityState( person );
actual.Should().Be.EqualTo( expected );
}
示例10: tansientEntity_afterPropertyChanges_GetEntityState_IsTransient_AutoRemove_HasBackwardChanges
public void tansientEntity_afterPropertyChanges_GetEntityState_IsTransient_AutoRemove_HasBackwardChanges()
{
EntityTrackingStates expected = EntityTrackingStates.IsTransient | EntityTrackingStates.AutoRemove | EntityTrackingStates.HasBackwardChanges;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
p.Name = "Mauro";
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例11: afterPropertyChanges_GetEntityState_is_Changed
public void afterPropertyChanges_GetEntityState_is_Changed()
{
EntityTrackingStates expected = EntityTrackingStates.HasBackwardChanges;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
p.Name = "Mauro";
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例12: after_mutual_exclusive_actions_entity_state_is_HasBackwardChanges
public void after_mutual_exclusive_actions_entity_state_is_HasBackwardChanges()
{
EntityTrackingStates expected = EntityTrackingStates.HasBackwardChanges;
IChangeTrackingService svc = new ChangeTrackingService();
PersonCollection p = new PersonCollection( svc );
p.Add( new Person( svc, false ) );
p.RemoveAt( 0 );
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例13: after_acceptChanges_entity_is_no_more_changed
public void after_acceptChanges_entity_is_no_more_changed()
{
EntityTrackingStates expected = EntityTrackingStates.None;
ChangeTrackingService svc = new ChangeTrackingService();
PersonCollection p = new PersonCollection( svc );
p.Add( new Person( null, false ) );
svc.AcceptChanges();
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例14: unchangedEntity_service_getEntityState_is_None
public void unchangedEntity_service_getEntityState_is_None()
{
EntityTrackingStates expected = EntityTrackingStates.None;
ChangeTrackingService svc = new ChangeTrackingService();
PersonCollection p = new PersonCollection( svc );
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例15: service_registerTransient_valid_reference_and_explicit_autoRemove_false
public void service_registerTransient_valid_reference_and_explicit_autoRemove_false()
{
EntityTrackingStates expected = EntityTrackingStates.IsTransient;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
svc.RegisterTransient( p, false );
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}