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


C# IUnitOfWork类代码示例

本文整理汇总了C#中IUnitOfWork的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork类的具体用法?C# IUnitOfWork怎么用?C# IUnitOfWork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IUnitOfWork类属于命名空间,在下文中一共展示了IUnitOfWork类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddFowardingServer

 public int AddFowardingServer(IUnitOfWork uow, ForwardingServer forwardingServer)
 {
     var mappedForwardingServer = Mapper.Map<SQL.Models.ForwardingServer>(forwardingServer);
     var id = Convert.ToInt32(uow.Db.Insert(mappedForwardingServer));
     Mapper.Map(mappedForwardingServer, forwardingServer);
     return id;
 }
开发者ID:nathantreid,项目名称:kolo-ns,代码行数:7,代码来源:ForwardingServersRepository.cs

示例2: AircraftsController

 public AircraftsController(
     IUnitOfWork unitOfWork,
     ILotRepository lotRepository,
     IInventoryRepository inventoryRepository,
     IAircraftRepository aircraftRepository,
     IAircraftRegistrationRepository aircraftRegistrationRepository,
     IAircraftRegMarkRepository aircraftRegMarkRepository,
     ISModeCodeRepository sModeCodeRepository,
     IFileRepository fileRepository,
     IApplicationRepository applicationRepository,
     ICaseTypeRepository caseTypeRepository,
     ILotEventDispatcher lotEventDispatcher,
     UserContext userContext)
 {
     this.unitOfWork = unitOfWork;
     this.lotRepository = lotRepository;
     this.inventoryRepository = inventoryRepository;
     this.aircraftRepository = aircraftRepository;
     this.aircraftRegistrationRepository = aircraftRegistrationRepository;
     this.aircraftRegMarkRepository = aircraftRegMarkRepository;
     this.sModeCodeRepository = sModeCodeRepository;
     this.fileRepository = fileRepository;
     this.applicationRepository = applicationRepository;
     this.caseTypeRepository = caseTypeRepository;
     this.lotEventDispatcher = lotEventDispatcher;
     this.userContext = userContext;
 }
开发者ID:MartinBG,项目名称:Gva,代码行数:27,代码来源:AircraftsController.cs

示例3: ExternalAuthSettings

 public ExternalAuthSettings(IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     AutoRegisterEnabled = true;
     GoogleSystemEnable = true;
     FacebookSystemEnable = true;
 }
开发者ID:raminmjj,项目名称:Decision,代码行数:7,代码来源:ExternalAuthSettings.cs

示例4: ThreadServices

 public ThreadServices(
     IRepository<Thread> threadRepository,
     IRepository<ThreadView> threadViewRepository,
     IRepository<Post> postRepository,
     IRepository<User> userRepository,
     IRepository<ThreadViewStamp> threadViewStampRepository,
     IRepository<Subscription> subscriptionRepository,
     IRepository<Attachment> attachmentRepository,
     PollServices pollServices,
     FileServices fileServices,
     ParseServices parseServices,
     RoleServices roleServices,
     IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     _threadRepository = threadRepository;
     _threadViewRepository = threadViewRepository;
     _postRepository = postRepository;
     _userRepository = userRepository;
     _threadViewStampRepository = threadViewStampRepository;
     _subscriptionRepository = subscriptionRepository;
     _attachmentRepository = attachmentRepository;
     _pollServices = pollServices;
     _fileServices = fileServices;
     _parseServices = parseServices;
     _roleServices = roleServices;
 }
开发者ID:anton-nesterenko,项目名称:mesoBoard,代码行数:27,代码来源:ThreadServices.cs

示例5: PatientServiceTest

 public PatientServiceTest()
 {
     patientRepository = Substitute.For<IPatientRepository>();
     unitOfWork = Substitute.For<IUnitOfWork>();
     validatorService = Substitute.For<IValidatorService>();
     patientService = new PatientService(patientRepository, unitOfWork, validatorService);
 }
开发者ID:Ramtin123,项目名称:CandidateScreening,代码行数:7,代码来源:PatientServiceTest.cs

示例6: SetUp

        public void SetUp()
        {
            mocks = new MockRepository();
            instance = mocks.DynamicMock<IUnitOfWork>();

            store = new ThreadedUnitOfWorkStore();
        }
开发者ID:ot-dan-smith,项目名称:Siege,代码行数:7,代码来源:ThreadedUnitOfWorkStoreTests.cs

示例7: TagService

        public TagService(IUnitOfWork unitOfWork, ITagValidation tagValidation)
            : base(unitOfWork)
        {
            Guard.NotNull(tagValidation, "tagValidation");

            this._tagValidation = tagValidation;
        }
开发者ID:Yura95st,项目名称:Doctrine,代码行数:7,代码来源:TagService.cs

示例8: PartnershipController

 //
 // GET: /Partnership/
 public PartnershipController(IUnitOfWork unitOfWork, PartnershipService partnershipService, StagedPartnershipService stagedPartnershipService, ChurchService churchService, PartnershipLogExcelFileHandler fileHandler) : base(unitOfWork)
 {
     _partnershipService = partnershipService;
     _stagedPartnershipService = stagedPartnershipService;
     _churchService = churchService;
     _fileHandler = fileHandler;
 }
开发者ID:edikep2000,项目名称:Zakar,代码行数:9,代码来源:PartnershipController.cs

示例9: AddAsync

        public virtual async Task<int> AddAsync(IUnitOfWork unitOfWork, List<IUser> entities,
            List<IUserRole> roles = null)
        {
            try
            {
                var result = 0;

                foreach (var entity in entities)
                {
                    result += await this.AddAsync(unitOfWork, entity);
                }

                if (roles != null)
                {
                    foreach (var role in roles)
                    {
                        result += await unitOfWork.AddAsync<UserRole>(
                            Mapper.Map<UserRole>(role));
                    }
                }
                return result;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
开发者ID:math-os,项目名称:mathos-scheduler,代码行数:27,代码来源:UserRepository.cs

示例10: AulaService

 public AulaService(IAulaRepository repoAula, IAlunoRepository repoAluno, ITurmaRepository repoTurma, IUnitOfWork unitOfWork)
 {
     _aulaRepository = repoAula;
     _alunoRepository = repoAluno;
     _turmaRepository = repoTurma;
     _unitOfWork = unitOfWork;
 }
开发者ID:thiagosartor,项目名称:Diario,代码行数:7,代码来源:AulaService.cs

示例11: Creator

 public Creator(IUnitOfWork unitOfWork, IRepository<Battle> repositoryOfBattle, IRepository<User> repositoryOfUser, IRepository<Team> repositoryOfTeam)
 {
     _unitOfWork = unitOfWork;
     _repositoryOfBattle = repositoryOfBattle;
     _repositoryOfUser = repositoryOfUser;
     _repositoryOfTeam = repositoryOfTeam;
 }
开发者ID:meze,项目名称:betteamsbattle,代码行数:7,代码来源:Creator.cs

示例12: CmsMembershipProvider

 /// <summary>
 /// Initializes a new instance of the <see cref="CmsMembershipProvider" /> class.
 /// </summary>
 /// <param name="userService">The user service.</param>
 /// <param name="authenticationService">The authentication service.</param>
 /// <param name="unitOfWork">The unit of work.</param>
 /// <param name="membershipName">Name of the membership.</param>
 internal CmsMembershipProvider(IUserService userService, IAuthenticationService authenticationService, IUnitOfWork unitOfWork, string membershipName)
 {
     this.authenticationService = authenticationService;
     this.userService = userService;
     this.unitOfWork = unitOfWork;
     this.membershipName = membershipName;
 }
开发者ID:navid60,项目名称:BetterCMS,代码行数:14,代码来源:CmsMembershipProvider.cs

示例13: CompositeEntitySeeder

 public CompositeEntitySeeder(IUnitOfWork unitOfWork
     , CoreSqlSeeder coreSqlSeeder
     //, LanguageEntitySeeder languageEntitySeeder
     , LanguageSqlSeeder languageSqlSeeder
     , PlaceByGeoPlanetEntitySeeder placeByGeoPlanetEntitySeeder
     , RoleEntitySeeder roleEntitySeeder
     , EstablishmentEntitySeeder establishmentEntitySeeder
     , EmailTemplateEntitySeeder emailTemplateEntitySeeder
     , PersonEntitySeeder personEntitySeeder
     , UserEntitySeeder userEntitySeeder
     , MemberEntitySeeder memberEntitySeeder
     , InstitutionalAgreementEntitySeeder institutionalAgreementEntitySeeder
     , InstitutionalAgreementSettingsEntitySeeder institutionalAgreementSettingsEntitySeeder
 )
 {
     _unitOfWork = unitOfWork;
     _coreSqlSeeder = coreSqlSeeder;
     _languageSqlSeeder = languageSqlSeeder;
     //_languageEntitySeeder = languageEntitySeeder;
     _placeByGeoPlanetEntitySeeder = placeByGeoPlanetEntitySeeder;
     _roleEntitySeeder = roleEntitySeeder;
     _establishmentEntitySeeder = establishmentEntitySeeder;
     _emailTemplateEntitySeeder = emailTemplateEntitySeeder;
     _personEntitySeeder = personEntitySeeder;
     _userEntitySeeder = userEntitySeeder;
     _memberEntitySeeder = memberEntitySeeder;
     _institutionalAgreementEntitySeeder = institutionalAgreementEntitySeeder;
     _institutionalAgreementSettingsEntitySeeder = institutionalAgreementSettingsEntitySeeder;
 }
开发者ID:danludwig,项目名称:UCosmic,代码行数:29,代码来源:CompositeEntitySeeder.cs

示例14: SetCurrentUow

        private static void SetCurrentUow(IUnitOfWork value, ILogger logger)
        {
            if (value == null)
            {
                ExitFromCurrentUowScope(logger);
                return;
            }

            var unitOfWorkKey = CallContext.LogicalGetData(ContextKey) as string;
            if (unitOfWorkKey != null)
            {
                IUnitOfWork outer;
                if (UnitOfWorkDictionary.TryGetValue(unitOfWorkKey, out outer))
                {
                    if (outer == value)
                    {
                        logger.Warn("Setting the same UOW to the CallContext, no need to set again!");
                        return;
                    }

                    value.Outer = outer;
                }
            }

            unitOfWorkKey = value.Id;
            if (!UnitOfWorkDictionary.TryAdd(unitOfWorkKey, value))
            {
                throw new AbpException("Can not set unit of work! UnitOfWorkDictionary.TryAdd returns false!");
            }

            logger.Debug("Entering a new UOW scope: " + unitOfWorkKey);
            CallContext.LogicalSetData(ContextKey, unitOfWorkKey);
        }
开发者ID:Why-Not-Sky,项目名称:aspnetboilerplate,代码行数:33,代码来源:CallContextCurrentUnitOfWorkProvider.cs

示例15: 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


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