本文整理汇总了C#中Session.Track方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Track方法的具体用法?C# Session.Track怎么用?C# Session.Track使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.Track方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_track_aggregate
public void Can_track_aggregate()
{
var session = new Session(this, this);
var aggregate = new SomeDomainEntity();
session.Track(aggregate);
}
示例2: Can_get_tracked_aggregate
public void Can_get_tracked_aggregate()
{
var session = new Session(this, this);
var aggregate = new SomeDomainEntity();
session.Track(aggregate);
var loadedAggregate = session.GetAggregateIfTracked<SomeDomainEntity>(aggregate.Id);
loadedAggregate.ShouldNotBeNull();
loadedAggregate.ShouldBeSameAs(aggregate);
}
示例3: Loads_aggregate_from_session_if_tracked
public void Loads_aggregate_from_session_if_tracked()
{
var trackedAggregate = new SomeDomainEntity();
var session = new Session(this, this);
session.Track(trackedAggregate);
var repository = new Repository<SomeDomainEntity>(this, session);
var loadedAggregate = repository.GetById(trackedAggregate.Id);
loadedAggregate.ShouldBeSameAs(trackedAggregate);
}
示例4: Events_are_published_to_bus_on_commit
public void Events_are_published_to_bus_on_commit()
{
var session = new Session(this, this);
var aggregate = new SomeDomainEntityWithEvents();
session.Track(aggregate);
var domainEvent = new SomeDomainEvent();
aggregate.Apply(domainEvent);
session.CommitChanges();
PublishedEvents.Count().ShouldBeEqualTo(1);
PublishedEvents.Pop().ShouldBeSameAs(domainEvent);
}
示例5: Can_commit_changes
public void Can_commit_changes()
{
var session = new Session(this, this);
var aggregate = new SomeDomainEntityWithEvents();
session.Track(aggregate);
var domainEvent = new SomeDomainEvent();
aggregate.Apply(domainEvent);
session.CommitChanges();
_savedId.ShouldBeEqualTo(aggregate.Id);
_savedEvents.Count().ShouldBeEqualTo(1);
_savedEvents.First().ShouldBeSameAs(domainEvent);
}