コード例 #1
0
        public EfCoreRepositoryTests(EfCoreDbcontextFixture fixture, ITestOutputHelper output)
        {
            _fixture = fixture;
            _output = output;
            _unitOfWork = _fixture.Container.Resolve<IUnitOfWork>();
            _userContext = _fixture.Container.Resolve<UserContext>();
            _cusRsp = _fixture.Container.Resolve<IEfRepository<Customer>>();
            _cusFinanceRsp = _fixture.Container.Resolve<IEfRepository<CusFinance>>();
            _cusLogsRsp = _fixture.Container.Resolve<IEfRepository<CusTransactionLog>>();

            Initialize().Wait();
        }
コード例 #2
0
 public UserAppService(IMapper mapper,
                       IEfRepository <SysUser> userRepository,
                       IDeptAppService deptAppService,
                       IRoleAppService roleAppService,
                       UsrManager usrManager)
 {
     _mapper         = mapper;
     _userRepository = userRepository;
     _deptAppService = deptAppService;
     _roleAppService = roleAppService;
     _usrManager     = usrManager;
 }
コード例 #3
0
 public UserAppService(IMapper mapper,
                       IEfRepository <SysUser> userRepository,
                       IEfRepository <SysDept> deptRepository,
                       IEfRepository <SysRole> roleRepository,
                       ISystemManagerService systemManagerService)
 {
     _mapper               = mapper;
     _userRepository       = userRepository;
     _deptRepository       = deptRepository;
     _roleRepository       = roleRepository;
     _systemManagerService = systemManagerService;
 }
コード例 #4
0
        public MaxscaleTests(MaxscaleDbcontextFixture fixture, ITestOutputHelper output)
        {
            _fixture       = fixture;
            _output        = output;
            _unitOfWork    = _fixture.Container.Resolve <IUnitOfWork>();
            _userContext   = _fixture.Container.Resolve <IOperater>();
            _cusRsp        = _fixture.Container.Resolve <IEfRepository <Customer> >();
            _cusFinanceRsp = _fixture.Container.Resolve <IEfRepository <CustomerFinance> >();
            _cusLogsRsp    = _fixture.Container.Resolve <IEfRepository <CustomerTransactionLog> >();

            Initialize();
        }
コード例 #5
0
ファイル: AccountAppService.cs プロジェクト: staoran/Adnc
 public AccountAppService(IEfRepository <SysUser> userRepository
                          , IEfRepository <SysRole> roleRepository
                          , IEfRepository <SysMenu> menuRepository
                          , RabbitMqProducer mqProducer
                          , CacheService cacheService)
 {
     _userRepository = userRepository;
     _roleRepository = roleRepository;
     _menuRepository = menuRepository;
     _mqProducer     = mqProducer;
     _cacheService   = cacheService;
 }
コード例 #6
0
 public SelectOptionsController(IEfRepository <Participant> repository
                                , ISelectOptionService selectOptionService
                                , IEfRepository <Event> eventRepository
                                , IMapper mapper
                                , IEfRepository <Guest> guestRepository)
 {
     _repository          = repository;
     _selectOptionService = selectOptionService;
     _eventRepository     = eventRepository;
     _mapper          = mapper;
     _guestRepository = guestRepository;
 }
コード例 #7
0
 public UserAppService(IMapper mapper,
                       IEfRepository <SysUser> userRepository,
                       IEfRepository <SysDept> deptRepository,
                       IEfRepository <SysRole> roleRepository,
                       IUsrManagerService usrManager)
 {
     _mapper         = mapper;
     _userRepository = userRepository;
     _deptRepository = deptRepository;
     _roleRepository = roleRepository;
     _usrManager     = usrManager;
 }
コード例 #8
0
ファイル: UserAppService.cs プロジェクト: AlphaYu/Adnc
 public UserAppService(
     IEfRepository <SysUser> userRepository
     , IEfRepository <SysRole> roleRepository
     , IEfRepository <SysMenu> menuRepository
     , CacheService cacheService
     , BloomFilterFactory bloomFilterFactory)
 {
     _userRepository     = userRepository;
     _roleRepository     = roleRepository;
     _menuRepository     = menuRepository;
     _cacheService       = cacheService;
     _bloomFilterFactory = bloomFilterFactory;
 }
コード例 #9
0
 public DeptAppService(IMapper mapper
                       , IHybridProviderFactory hybridProviderFactory
                       , IEasyCachingProviderFactory simpleProviderFactory
                       , IEfRepository <SysDept> deptRepository
                       , ISystemManagerService systemManagerService)
 {
     _mapper               = mapper;
     _cache                = hybridProviderFactory.GetHybridCachingProvider(EasyCachingConsts.HybridCaching);
     _locaCahce            = simpleProviderFactory.GetCachingProvider(EasyCachingConsts.LocalCaching);
     _redisCache           = simpleProviderFactory.GetCachingProvider(EasyCachingConsts.RemoteCaching);
     _deptRepository       = deptRepository;
     _systemManagerService = systemManagerService;
 }
コード例 #10
0
 public EfController(
     ILogger <DBLogger> logger,
     IEfRepository <Book> bookRepository,
     IEfRepository <Author> authorRepository,
     IEfRepository <Tag> tagRepository,
     IEfRepository <BookTag> bookTagRepository)
 {
     _logger            = logger;
     _bookRepository    = bookRepository;
     _authorRepository  = authorRepository;
     _tagRepository     = tagRepository;
     _bookTagRepository = bookTagRepository;
 }
コード例 #11
0
ファイル: ProductAppService.cs プロジェクト: xwyangjshb/Adnc
 /// <summary>
 /// 商品管理构造函数
 /// </summary>
 /// <param name="productRepo"></param>
 /// <param name="warehouseInfoRepo"></param>
 /// <param name="maintRpcSrv"></param>
 /// <param name="productMgr"></param>
 /// <param name="mapper"></param>
 public ProductAppService(
     IEfRepository <Product> productRepo
     , IEfRepository <WarehouseInfo> warehouseInfoRepo
     , IMaintRpcService maintRpcSrv
     , ProductManager productMgr
     , IMapper mapper)
 {
     _productMgr        = productMgr;
     _productRepo       = productRepo;
     _warehouseInfoRepo = warehouseInfoRepo;
     _maintRpcSrv       = maintRpcSrv;
     _mapper            = mapper;
 }
コード例 #12
0
ファイル: MaxscaleTests.cs プロジェクト: AlphaYu/Adnc
 public MaxscaleTests(MaxscaleDbcontextFixture fixture, ITestOutputHelper output)
 {
     _fixture       = fixture;
     _output        = output;
     _unitOfWork    = _fixture.Container.GetRequiredService <IUnitOfWork>();
     _cusRsp        = _fixture.Container.GetRequiredService <IEfRepository <Customer> >();
     _cusFinanceRsp = _fixture.Container.GetRequiredService <IEfRepository <CustomerFinance> >();
     _cusLogsRsp    = _fixture.Container.GetRequiredService <IEfRepository <CustomerTransactionLog> >();
     if (IdGenerater.CurrentWorkerId < 0)
     {
         IdGenerater.SetWorkerId(1);
     }
 }
コード例 #13
0
 public RestaurantService(
     IEfRepository <Restaurant> restaurantRepository,
     IEfRepository <User> userRepository,
     IEfRepository <Table> tableRepository,
     IUserRoleService userRoleService,
     ISaveContext saveContext)
 {
     this.restaurantRepository = restaurantRepository;
     this.userRepository       = userRepository;
     this.tableRepository      = tableRepository;
     this.userRoleService      = userRoleService;
     this.saveContext          = saveContext;
 }
コード例 #14
0
 public UsrManagerService(IEfRepository <SysUser> userRepository
                          , IEfRepository <SysUserFinance> financeRepository
                          , IEfRepository <SysRelation> relationRepository
                          , IEfRepository <SysMenu> menuRepository
                          , IEfRepository <SysDept> deptRepository
                          )
 {
     _userRepository     = userRepository;
     _financeRepository  = financeRepository;
     _relationRepository = relationRepository;
     _menuRepository     = menuRepository;
     _deptRepository     = deptRepository;
 }
コード例 #15
0
        public void ThrowsArgumentNullException_WhenChallengesRepository_IsNull()
        {
            // Arrange
            var submisionsRepoFake = new Mock <IEfRepository <Submission> >();;
            IEfRepository <Challenge> challengeRepo = null;
            var efData     = new Mock <IEfData>();
            var timeFake   = new Mock <ITimeProvider>();
            var mapperFake = new Mock <IMappingProvider>();

            // Act and Assert
            Assert.Throws <ArgumentNullException>(() => new SubmissionsService(submisionsRepoFake.Object, challengeRepo, efData.Object,
                                                                               timeFake.Object, mapperFake.Object));
        }
コード例 #16
0
        public static async Task <List <SysMenu> > GetMenusByRoleIdsAsync(this IEfRepository <SysMenu> repo, long[] roleIds, bool enabledOnly)
        {
            var query = repo.GetAll <SysRelation>().Where(r => roleIds.Contains(r.RoleId))
                        .Select(u => new { u.Menu });

            if (enabledOnly)
            {
                query = query.Where(r => r.Menu.Status);
            }

            var relations = await query.ToListAsync();

            return(relations.Select(d => d.Menu).Distinct().ToList());
        }
コード例 #17
0
 public ParticipantsController(IParticipantService service
                               , IEfRepository <Participant> repository
                               , IPasswordHasher passwordHasher
                               , IWebHostEnvironment hostEnvironment
                               , IImageHelper imageHelper
                               , IMapper mapper)
 {
     _service         = service;
     _repository      = repository;
     _passwordHasher  = passwordHasher;
     _hostEnvironment = hostEnvironment;
     _imageHelper     = imageHelper;
     _mapper          = mapper;
 }
コード例 #18
0
        public UserService(
            IEfRepository <User> usersRepo,
            ISaveContext context,
            IRoleService roleService
            )
        {
            Guard.WhenArgument(usersRepo, "usersRepo").IsNull().Throw();
            Guard.WhenArgument(context, "context").IsNull().Throw();
            Guard.WhenArgument(roleService, "roleService").IsNull().Throw();

            this.roleService = roleService;
            this.usersRepo   = usersRepo;
            this.context     = context;
        }
コード例 #19
0
ファイル: AccountAppService.cs プロジェクト: wuhz520/Adnc
 public AccountAppService(IMapper mapper,
                          IEfRepository <SysUser> userRepository,
                          IEfRepository <SysRole> roleRepository,
                          IEfRepository <SysMenu> menuRepository,
                          IEfRepository <NullEntity> rsp,
                          RabbitMqProducer mqProducer)
 {
     _mapper         = mapper;
     _userRepository = userRepository;
     _roleRepository = roleRepository;
     _menuRepository = menuRepository;
     _rsp            = rsp;
     _mqProducer     = mqProducer;
 }
コード例 #20
0
 public ReportsController(IReportSuiteRepository reportSuiteSqlRepository
                          , IEfRepository <ReportSuite> reportSuiteRepository
                          , IEfRepository <ReportSuiteExternalSetup> reportSuiteExternalSetupRepository
                          , IEfRepository <ReportSuiteColumnValue> reportSuiteColumnValueRepository
                          , RDLReportDocument reportDocument
                          , IMapper mapper)
 {
     _reportSuiteSqlRepository           = reportSuiteSqlRepository;
     _reportSuiteRepository              = reportSuiteRepository;
     _reportSuiteExternalSetupRepository = reportSuiteExternalSetupRepository;
     _reportSuiteColumnValueRepository   = reportSuiteColumnValueRepository;
     _reportDocument = reportDocument;
     _mapper         = mapper;
 }
コード例 #21
0
 public RoleAppService(IMapper mapper,
                       IEfRepository <SysRole> roleRepository,
                       IEfRepository <SysUser> userRepository,
                       IEfRepository <SysRelation> relationRepository,
                       IUsrManagerService systemManagerService,
                       IHybridProviderFactory hybridProviderFactory)
 {
     _mapper               = mapper;
     _roleRepository       = roleRepository;
     _userRepository       = userRepository;
     _systemManagerService = systemManagerService;
     _relationRepository   = relationRepository;
     _cache = hybridProviderFactory.GetHybridCachingProvider(EasyCachingConsts.HybridCaching);
 }
コード例 #22
0
        private static async Task <PaginatedItem <TResponse> > GetDataAsync <TDbContext, TEntity, TResponse>(
            IEfRepository <TDbContext, TEntity> repo,
            Criterion criterion,
            Expression <Func <TEntity, TResponse> > selector,
            Expression <Func <TEntity, bool> > filter = null,
            params Expression <Func <TEntity, object> >[] includeProperties)
            where TDbContext : DbContext
            where TEntity : EntityBase
        {
            if (criterion.PageSize < 1 || criterion.PageSize > criterion.DefaultPagingOption.PageSize)
            {
                criterion.SetPageSize(criterion.DefaultPagingOption.PageSize);
            }

            var queryable   = repo.DbContext.Set <TEntity>() as IQueryable <TEntity>;
            var totalRecord = await queryable.CountAsync();

            var totalPages = (int)Math.Ceiling((double)totalRecord / criterion.PageSize);

            foreach (var includeProperty in includeProperties)
            {
                queryable = queryable.Include(includeProperty);
            }

            if (filter != null)
            {
                queryable = queryable.Where(filter);
            }

            if (!string.IsNullOrWhiteSpace(criterion.SortBy))
            {
                var isDesc = string.Equals(criterion.SortOrder, "desc", StringComparison.OrdinalIgnoreCase) ? true : false;
                queryable = queryable.OrderByPropertyName(criterion.SortBy, isDesc);
            }

            if (criterion.CurrentPage > totalPages)
            {
                criterion.SetCurrentPage(totalPages);
            }

            var results = await queryable
                          .Skip(criterion.CurrentPage *criterion.PageSize)
                          .Take(criterion.PageSize)
                          .AsNoTracking()
                          .Select(selector)
                          .ToListAsync();

            return(new PaginatedItem <TResponse>(totalRecord, totalPages, results));
        }
コード例 #23
0
        public BreweryService(IEfRepository <Brewery> breweryRepository, IEfRepository <Beer> beerRepository)
        {
            if (breweryRepository == null)
            {
                throw new ArgumentNullException(nameof(breweryRepository));
            }

            if (beerRepository == null)
            {
                throw new ArgumentNullException(nameof(beerRepository));
            }

            this.beerRepository    = beerRepository;
            this.breweryRepository = breweryRepository;
        }
コード例 #24
0
 public BasicCrudInteractor(
     IMediator mediator,
     IOptions <PagingOption> pagingOption,
     IEfRepository <BlogDbContext, Core.Domain.Blog> blogRepository,
     IValidator <CreateBlogRequest> createItemValidator,
     IValidator <UpdateBlogRequest> updateItemValidator,
     IValidator <DeleteBlogRequest> deleteItemValidator)
 {
     _blogRepository      = blogRepository;
     _mediator            = mediator;
     _pagingOption        = pagingOption;
     _createItemValidator = createItemValidator;
     _updateItemValidator = updateItemValidator;
     _deleteItemValidator = deleteItemValidator;
 }
コード例 #25
0
        //private readonly IdentityClaimsProfileService _identityService;

        public PortfolioController(IEfRepository <Project> projectRepository
                                   , ILogger <PortfolioController> logger
                                   , IMapper mapper
                                   , ICommonHelpers commonHelpers
                                   , IFormFileProcessor formFileProcessor
                                   //, IdentityClaimsProfileService identityService
                                   )
        {
            _projectRepository = projectRepository;
            _logger            = logger;
            _mapper            = mapper;
            _commonHelpers     = commonHelpers;
            _formFileProcessor = formFileProcessor;
            //_identityService = identityService;
        }
コード例 #26
0
        public PageDataQueryAppService(
            IObjectMapper objectMapper,
            PageDataManager pageDataManager,
            IEfRepository <ContentComponentData, int> componentDataRepository,
            IAbpSession abpSession
            )
        {
            _objectMapper = objectMapper;

            _pageDataManager = pageDataManager;

            _componentDataRepository = componentDataRepository;

            _abpSession = abpSession;
        }
コード例 #27
0
        public CompaniesService(IEfRepository <Company> repository, IImageService imageService)
        {
            if (repository == null)
            {
                throw new ArgumentException("IEfRepository in company service is null.");
            }

            if (imageService == null)
            {
                throw new ArgumentException("imageservice");
            }

            this.repository   = repository;
            this.imageService = imageService;
        }
コード例 #28
0
        public TopBeersService(IEfRepository <BeerReview> reviewsRepository, IRankCalculationStrategy strategy)
        {
            if (reviewsRepository == null)
            {
                throw new ArgumentNullException(nameof(reviewsRepository));
            }

            if (strategy == null)
            {
                throw new ArgumentNullException(nameof(strategy));
            }

            this.strategy          = strategy;
            this.reviewsRepository = reviewsRepository;
        }
コード例 #29
0
ファイル: CrudExtensions.cs プロジェクト: zxbe/blog-core
        public static async Task <TDeleteItemResponse> DeleteItemFlowAsync <TDbContext, TEntity, TDeleteItemResponse>(
            this IEfRepository <TDbContext, TEntity> repo,
            Guid id,
            Func <TEntity, TDeleteItemResponse> mapResponseFunc,
            Action <TEntity> raiseEventAction = null,
            params Expression <Func <TEntity, object> >[] includes)
            where TEntity : EntityBase
            where TDbContext : DbContext
        {
            var item = await repo.GetByIdAsync(id, includes);

            var itemDeleted = await repo.DeleteAsync(item);

            raiseEventAction?.Invoke(itemDeleted);
            return(mapResponseFunc(itemDeleted));
        }
コード例 #30
0
ファイル: CrudExtensions.cs プロジェクト: zxbe/blog-core
        public static async Task <TCreateItemResponse> CreateItemFlowAsync <TDbContext, TEntity, TCreateItemRequest, TCreateItemResponse>(
            this IEfRepository <TDbContext, TEntity> repo,
            TCreateItemRequest request,
            Func <TCreateItemRequest, TEntity> mapCreateItemFunc,
            Func <TEntity, TCreateItemResponse> mapResponseFunc,
            Action <TEntity> raiseEventAction = null)
            where TEntity : EntityBase
            where TDbContext : DbContext
            where TCreateItemRequest : UseCase.IRequest <TCreateItemResponse>
        {
            var createEntity  = mapCreateItemFunc(request);
            var entityCreated = await repo.AddAsync(createEntity);

            raiseEventAction?.Invoke(entityCreated);
            return(mapResponseFunc(entityCreated));
        }
コード例 #31
0
 public MealsRepository(IEfRepository efRepository)
 {
     _efRepository = efRepository;
 }
コード例 #32
0
 public TestApplicationService(IEfRepository<Students> studentRepository, IUnitOfWorkManager uowManger,ILogger logger)
 {
     _studentRepository = studentRepository;
     _uowManger = uowManger;
     _logger = logger;
 }
コード例 #33
0
 /// <summary>
 /// 
 /// </summary>
 public ProductsController(IEfRepository<DAL.Product> repository)
 {
     Repository = repository;
 }
コード例 #34
0
 public TestApplicationBiz(IEfRepository<Students> studentRepository, IUnitOfWorkManager uowManger)
 {
     _studentRepository = studentRepository;
     _uowManger = uowManger;
 }
コード例 #35
0
 public LogRepository(IEfRepository efRepository)
 {
     _efRepository = efRepository;
 }