Esempio n. 1
0
 public DataItemService(IBackendUnitOfWork backendUnitOfWork,
                        ICacheManager <object> cacheManager,
                        ICrudDtoMapper <DataItemEntity, DataItemViewModel, long> curdDtoMapper)
 {
     _backendUnitOfWork = backendUnitOfWork;
     _cacheManager      = cacheManager;
     _curdDtoMapper     = curdDtoMapper;
 }
 /// <summary>
 /// 初始化构造
 /// 用于不同的个上下文,使用注入的工作单元
 /// </summary>
 /// <param name="dbContext">上下文实例</param>
 /// <param name="service">服务集合</param>
 /// <param name="logger">日志</param>
 protected CrudControllerBase(IEFCoreUnitOfWork unitOfWork, IServiceCollection service, ILogger <Controller> logger) : base(service, logger)
 {
     _validator     = service.BuildServiceProvider().GetService <FluentValidation.IValidator <TCodeTabelModel> >();
     _repository    = new EFCoreBaseRepository <TCodeTabelEntity>(unitOfWork.Context);
     _readerService = new GenericReaderService <TCodeTabelEntity, long>(logger, _repository);
     _writerService = new GenericWriterService <TCodeTabelEntity, long>(logger, _repository, unitOfWork);
     CrudDtoMapper  = service.BuildServiceProvider().GetService <ICrudDtoMapper <TCodeTabelEntity, TCodeTabelModel> >();
 }
 /// <summary>
 /// 初始化构造
 /// 使用注入的同一个上下文
 /// </summary>
 /// <param name="service">服务集合</param>
 /// <param name="logger">日志</param>
 protected CrudControllerBase(IServiceCollection service, ILogger <Controller> logger) : base(service, logger)
 {
     _validator     = service.BuildServiceProvider().GetService <FluentValidation.IValidator <TCodeTabelModel> >();
     _readerService = service.BuildServiceProvider().GetService <IGenericReaderService <TCodeTabelEntity, long> >();
     _writerService = service.BuildServiceProvider().GetService <IGenericWriterService <TCodeTabelEntity, long> >();
     _repository    = service.BuildServiceProvider().GetService <IEFCoreQueryableRepository <TCodeTabelEntity, long> >();
     CrudDtoMapper  = service.BuildServiceProvider().GetService <ICrudDtoMapper <TCodeTabelEntity, TCodeTabelModel> >();
 }
Esempio n. 4
0
 public RoleApiController(IServiceCollection collection, ILogger <RoleApiController> logger,
                          IRoleService roleService,
                          IMediator mediator,
                          RoleManager <RoleEntity> roleManager,
                          IRoleRules roleRules,
                          IServiceCollection service,
                          ICrudDtoMapper <RoleEntity, RoleViewModel, long> crudDtoMapper)
     : base(service, logger)
 {
     this._roleService   = roleService;
     this._mediator      = mediator;
     this._roleManager   = roleManager;
     this._crudDtoMapper = crudDtoMapper;
     this._roleRules     = roleRules;
 }
Esempio n. 5
0
 public UserApiController(IBaseUnitOfWork baseUnitOfWork,
                          UserManager <UserEntity> userManager,
                          IUserRules userRules,
                          ISecurityService securityService,
                          IUserNameResolver userNameResolver,
                          IServiceCollection service,
                          ILogger <UserApiController> logger,
                          ICrudDtoMapper <UserEntity, UserViewModel, long> crudDtoMapper) : base(service, logger)
 {
     this._baseUnitOfWork   = baseUnitOfWork;
     this._userManager      = userManager;
     this._userRules        = userRules;
     this._userNameResolver = userNameResolver;
     this._securityService  = securityService;
     this._crudDtoMapper    = crudDtoMapper;
 }