• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IUnitOfWork类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IUnitOfWork类属于命名空间,在下文中一共展示了IUnitOfWork类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: GenerateCodeId

        public static string GenerateCodeId(string codeTypeId, IUnitOfWork context)
        {
            var codeIds = context.FindAll<Code>().Where(c => c.CodeTypeId == codeTypeId).OrderBy(f => f.CodeId).Select(ci => ci.CodeId).ToList();
            var lastCodeId = codeIds.Count > 0 ? codeIds.Last() : null;
            var IdCharCount = lastCodeId != null ? lastCodeId.Count() - 1 : 9;
            List<char> chars = codeTypeId.ToList();
            var charArray = chars.ToArray();
            var numberId = 0;

            if (lastCodeId != null)
            {
                numberId = int.Parse(lastCodeId.TrimStart(charArray));

                if (lastCodeId[3].ToString(CultureInfo.InvariantCulture) == "1")
                {
                    numberId++;
                }
            }

            var newId = codeTypeId + numberId.ToString(CultureInfo.InvariantCulture);

            var charCount = (codeTypeId + numberId.ToString(CultureInfo.InvariantCulture)).Count();

            if (charCount < IdCharCount)
            {
                newId = string.Format(codeTypeId + '1' + new string('0', IdCharCount - charCount) + numberId.ToString(CultureInfo.InvariantCulture));

            }

            return newId;
        }
开发者ID:jfellwock,项目名称:sql-stuffs,代码行数:31,代码来源:IdentityGeneratorUtility.cs


示例16: MainService

 public MainService(IUnitOfWork uow, ILotRepository lotrepository, ICathegoryRepository cathegoryRepository, IImageRepository imageRepository)
 {
     this.uow = uow;
     this.lotRepository = lotrepository;
     this.cathegoryRepository = cathegoryRepository;
     this.imageRepository = imageRepository;
 }
开发者ID:Titof2123709,项目名称:Auction2,代码行数:7,代码来源:MainService.cs


示例17: CustomerService

 public CustomerService(
     IUnitOfWork unitOfWork, 
     ICustomerRepository customerRepository)
 {
     UnitOfWork = unitOfWork;
     _customerRepository = customerRepository;
 }
开发者ID:BernieCook,项目名称:CacheAspect,代码行数:7,代码来源:CustomerService.cs


示例18: ArticleUnitViewModelList

 public static IEnumerable<ArticleUnitViewModel> ArticleUnitViewModelList(IUnitOfWork uow, IEnumerable<Article> articles)
 {
     var votesList = HttpRuntime.Cache.Get("PopularArticlesAndVotes") as IDictionary<int, int>;
     if (votesList == null)
     {
         votesList = uow.ArticleRepository.GetPopularArticlesIdAndVotes();
         HttpRuntime.Cache["PopularArticlesAndVotes"] = votesList;
     }
     var newList = new List<ArticleUnitViewModel>();
     foreach (var item in articles)
     {
         newList.Add(new ArticleUnitViewModel
         {
             Id = item.Id,
             Title = item.Title,
             Description = item.Description,
             UserId = item.UserId,
             Username = item.User.UserName,
             Items = item.Items.Count,
             Tags = item.Tags,
             Votes = votesList.Where(x => x.Key == item.Id).Select(x => x.Value).FirstOrDefault()
         });
     }
     return newList;
 }
开发者ID:nancy-bree,项目名称:CreativeFactory,代码行数:25,代码来源:ArticleService.cs


示例19: Setup

        public void Setup()
        {
            var container = SetupTest.Container;

            _usuarioRepository = container.Resolve<IUsuarioRepository>();
            _unitOfWork = container.Resolve<IUnitOfWork>();
        }
开发者ID:henriqueprj,项目名称:SampleArchiteture,代码行数:7,代码来源:UsuarioRepositoryTests.cs


示例20: VideoService

 public VideoService(
     IUnitOfWork unitOfWork,
     IVideoRepository videoRepository)
 {
     this._unitOfWork = unitOfWork;
     this._videoRepository = videoRepository;
 }
开发者ID:selombanybah,项目名称:Kelasi,代码行数:7,代码来源:VideoService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IUnitOfWorkAsync类代码示例发布时间:2022-05-24
下一篇:
C# IUnitDef类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap