本文整理汇总了C#中IUnitOfWork.PersistAll方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.PersistAll方法的具体用法?C# IUnitOfWork.PersistAll怎么用?C# IUnitOfWork.PersistAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.PersistAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
var memberFactory = new MemberFactory();
_email = Guid.NewGuid().ToString();
_decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository);
_oldCount = _unitOfWork.MemberRepository.Count();
_member = memberFactory.CreateMember(_email);
_sameMember = memberFactory.CreateMember(_email);
_decorator.Add(_member);
_unitOfWork.PersistAll();
using (var uow = new UnitOfWork())
{
_newCount = uow.MemberRepository.Count();
try
{
_loadedMember = uow.MemberRepository.Get(_member.Id);
}
catch (Exception)
{
_loadedMember = null;
}
}
}
示例2: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
_memberFactory = new MemberFactory();
_gomeeFactory = new GomeeFactory();
_targetFactory = new TargetFactory();
_targetDecorator = new TargetDecorator(_targetFactory, _unitOfWork.TargetRepository);
_member = _memberFactory.CreateMember(Guid.NewGuid().ToString());
_gomee = _gomeeFactory.CreateGomee(_member);
_target = _targetFactory.CreateGomeeTarget(_member, _gomee);
using (var uow = new UnitOfWork())
{
uow.MemberRepository.Add(_member);
uow.GomeeRepository.Add(_gomee);
uow.TargetRepository.Add(_target);
uow.PersistAll();
_oldCount = uow.TargetRepository.Count();
}
_targetDecorator.Remove(_unitOfWork.TargetRepository.Get(_target.Id));
_unitOfWork.PersistAll();
_newCount = _unitOfWork.TargetRepository.Count();
try
{
_loadedTarget = _unitOfWork.TargetRepository.Get(_target.Id);
}
catch (ArgumentException)
{
_loadedTarget = null;
}
}
示例3: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
_factory = new MemberFactory();
_decorator = new MemberDecorator(_factory, _unitOfWork.MemberRepository);
_member = _factory.CreateMember(Guid.NewGuid().ToString());
using (var uow = new UnitOfWork())
{
uow.MemberRepository.Add(_member);
uow.PersistAll();
_oldCount = uow.MemberRepository.Count();
}
_decorator.Remove(_unitOfWork.MemberRepository.Get(_member.Id));
_unitOfWork.PersistAll();
_newCount = _unitOfWork.MemberRepository.Count();
try
{
_loadedMember = _unitOfWork.MemberRepository.Get(_member.Id);
}
catch (ArgumentException)
{
_loadedMember = null;
}
}
示例4: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
_memberFactory = new MemberFactory();
_gomeeFactory = new GomeeFactory();
_gomeeDecorator = new GomeeDecorator(_gomeeFactory, _unitOfWork.GomeeRepository);
_member = _memberFactory.CreateMember(Guid.NewGuid().ToString());
_gomee = _gomeeFactory.CreateGomee(_member);
_oldCount = _unitOfWork.GomeeRepository.Count();
_unitOfWork.MemberRepository.Add(_member);
_gomeeDecorator.Add(_gomee);
_unitOfWork.PersistAll();
using (var uow = new UnitOfWork())
{
_newCount = uow.GomeeRepository.Count();
_loadedGomee = uow.GomeeRepository.Get(_gomee.Id);
}
}
示例5: SetUp
public static void SetUp(TestContext context)
{
_unitOfWork = new UnitOfWork();
_memberDecorator = new MemberDecorator(new MemberFactory(), _unitOfWork.MemberRepository);
_friendDecorator = new FriendDecorator(new FriendFactory(), _unitOfWork.FriendRepository);
_member1 = _memberDecorator.CreateMember(Guid.NewGuid().ToString());
_member2 = _memberDecorator.CreateMember(Guid.NewGuid().ToString());
_friend = _friendDecorator.CreateFriend(_member1, _member2);
_oldCount = _friendDecorator.Count();
_memberDecorator.Add(_member1);
_memberDecorator.Add(_member2);
_friendDecorator.Add(_friend);
_unitOfWork.PersistAll();
using (var uow = new UnitOfWork())
{
_newCount = uow.FriendRepository.Count();
_loadedFriend = uow.FriendRepository.Get(_friend.Id);
}
}