本文整理汇总了C#中Topics.Radical.ChangeTracking.ChangeTrackingService.RegisterTransient方法的典型用法代码示例。如果您正苦于以下问题:C# ChangeTrackingService.RegisterTransient方法的具体用法?C# ChangeTrackingService.RegisterTransient怎么用?C# ChangeTrackingService.RegisterTransient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topics.Radical.ChangeTracking.ChangeTrackingService
的用法示例。
在下文中一共展示了ChangeTrackingService.RegisterTransient方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: after_suspend_cannot_call_RegisterTransient_with_explicit_autoRemove_false
public void after_suspend_cannot_call_RegisterTransient_with_explicit_autoRemove_false()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
svc.Suspend();
svc.RegisterTransient( p, false );
}
示例3: 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();
}
示例4: 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 );
}
示例5: after_suspend_cannot_call_RegisterTransient
public void after_suspend_cannot_call_RegisterTransient()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
svc.Suspend();
svc.RegisterTransient( p );
}
示例6: explicit_registerAsTransient_without_autoRemove_throws_exception_if_already_registered
public void explicit_registerAsTransient_without_autoRemove_throws_exception_if_already_registered()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
svc.RegisterTransient( p, false );
}
示例7: entity_registeredAsTransient_without_autoRemove_on_AcceptChanges_is_no_more_transient
public void entity_registeredAsTransient_without_autoRemove_on_AcceptChanges_is_no_more_transient()
{
ChangeTrackingService svc = new ChangeTrackingService();
EntityTrackingStates expected = EntityTrackingStates.None;
Person p = new Person( svc, false );
svc.RegisterTransient( p, false );
svc.AcceptChanges();
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例8: 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 );
}
示例9: after_explicit_registerAsTransient_with_autoRemove_false_entityTrackingStates_is_transient
public void after_explicit_registerAsTransient_with_autoRemove_false_entityTrackingStates_is_transient()
{
ChangeTrackingService svc = new ChangeTrackingService();
EntityTrackingStates expected = EntityTrackingStates.IsTransient;
Person p = new Person( svc, false );
svc.RegisterTransient( p, false );
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例10: service_on_registerTransient_with_explicit_autoRemove_true_raise_trackingServiceStateChanged_event
public void service_on_registerTransient_with_explicit_autoRemove_true_raise_trackingServiceStateChanged_event()
{
Int32 expected = 1;
Int32 actual = 0;
ChangeTrackingService svc = new ChangeTrackingService();
svc.TrackingServiceStateChanged += ( sender, args ) => { actual++; };
Person p = new Person( svc, false );
svc.RegisterTransient( p, true );
Assert.AreEqual<Int32>( expected, actual );
}
示例11: 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 );
}
示例12: service_double_registerTransient_with_same_reference_invalidOperationException
public void service_double_registerTransient_with_same_reference_invalidOperationException()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
svc.RegisterTransient( p );
}
示例13: service_registerTransient_null_reference_explicit_autoRemove_false_argumentNullException
public void service_registerTransient_null_reference_explicit_autoRemove_false_argumentNullException()
{
ChangeTrackingService svc = new ChangeTrackingService();
svc.RegisterTransient( null, false );
}
示例14: service_registerTransient_null_reference_argumentNullException
public void service_registerTransient_null_reference_argumentNullException()
{
ChangeTrackingService svc = new ChangeTrackingService();
svc.RegisterTransient( null );
}