当前位置: 首页>>代码示例>>C#>>正文


C# IUnitOfWork.PersistAll方法代码示例

本文整理汇总了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;
                }
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:29,代码来源:When_add_member.cs

示例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;
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:35,代码来源:When_remove_target.cs

示例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;
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:30,代码来源:When_remove_member.cs

示例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);
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:21,代码来源:When_add_gomee.cs

示例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);
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:23,代码来源:When_add_friend.cs


注:本文中的IUnitOfWork.PersistAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。