public SystemController(ISystemService systemService, IOptionsMonitor <ModuleCommonOptions> optionsMonitor, FileUploadHelper fileUploadHelper, MvcHelper mvcHelper) { _systemService = systemService; _fileUploadHelper = fileUploadHelper; _mvcHelper = mvcHelper; _options = optionsMonitor.CurrentValue; }
public AttachmentController(IAttachmentService service, ILoginInfo loginInfo, FileUploadHelper fileUploadHelper, IOptionsMonitor <ModuleCommonOptions> iOptionsMonitor) { _service = service; _loginInfo = loginInfo; _fileUploadHelper = fileUploadHelper; _moduleCommonOptions = iOptionsMonitor.CurrentValue; }
public AttachmentController(IAttachmentService service, ILoginInfo loginInfo, FileUploadHelper fileUploadHelper, ModuleCommonOptions moduleCommonOptions) { _service = service; _loginInfo = loginInfo; _fileUploadHelper = fileUploadHelper; _moduleCommonOptions = moduleCommonOptions; }
public AttachmentService(IAttachmentRepository repository, IAttachmentOwnerRepository ownerRepository, IOptionsMonitor <ModuleCommonOptions> moduleCommonOptionsMonitor, IMediaTypeRepository mediaTypeRepository, IMapper mapper) { _repository = repository; _ownerRepository = ownerRepository; _moduleCommonOptions = moduleCommonOptionsMonitor.CurrentValue; _mediaTypeRepository = mediaTypeRepository; _mapper = mapper; }
public AttachmentService(IAttachmentRepository repository, IUnitOfWork <CommonDbContext> uow, IAttachmentOwnerRepository ownerRepository, LoginInfo loginInfo, IOptionsMonitor <CommonOptions> optionsMonitor, IOptionsMonitor <ModuleCommonOptions> moduleCommonOptionsMonitor, FileUploadHelper fileUploadHelper, IMediaTypeRepository mediaTypeRepository, IMapper mapper) { _repository = repository; _uow = uow; _ownerRepository = ownerRepository; _loginInfo = loginInfo; _moduleCommonOptions = moduleCommonOptionsMonitor.CurrentValue; _fileUploadHelper = fileUploadHelper; _mediaTypeRepository = mediaTypeRepository; _mapper = mapper; }
public ProjectService(IProjectRepository repository, IMapper mapper, IOptionsMonitor <ModuleCommonOptions> optionsMonitor, IClassRepository classRepository, IPropertyRepository propertyRepository, IEnumRepository enumRepository, IEnumItemRepository enumItemRepository, IModelPropertyRepository modelPropertyRepository, IOptionsMonitor <CodeGeneratorOptions> codeGeneratorOptions) { _repository = repository; _mapper = mapper; _classRepository = classRepository; _propertyRepository = propertyRepository; _enumRepository = enumRepository; _enumItemRepository = enumItemRepository; _modelPropertyRepository = modelPropertyRepository; _codeGeneratorOptions = codeGeneratorOptions.CurrentValue; _commonOptions = optionsMonitor.CurrentValue; }
public ClassController(IClassService service, IOptionsMonitor <ModuleCommonOptions> commonOption, IOptionsMonitor <CodeGeneratorOptions> codeGeneratorOptions) { _service = service; _codeGeneratorOptions = codeGeneratorOptions.CurrentValue; _commonOptions = commonOption.CurrentValue; }
public UserController(IUserService service, IOptionsMonitor <ModuleCommonOptions> optionsMonitor, FileUploadHelper fileUploadHelper) { _service = service; _options = optionsMonitor.CurrentValue; _fileUploadHelper = fileUploadHelper; }
/// <summary> /// 添加Excel /// </summary> /// <param name="services"></param> /// <param name="environmentName"></param> /// <param name="moduleCommonOptions"></param> /// <returns></returns> public static IServiceCollection AddExcel(this IServiceCollection services, string environmentName, ModuleCommonOptions moduleCommonOptions) { var options = new ConfigurationHelper().Get <ExcelOptions>("Excel", environmentName); if (options == null) { return(services); } if (options.TempPath.IsNull()) { options.TempPath = Path.Combine(moduleCommonOptions.TempPath, "Excel"); } services.AddSingleton(options); var assembly = AssemblyHelper.LoadByNameEndString($".Lib.Excel.{options.Provider.ToDescription()}"); Check.NotNull(assembly, $"Excel实现程序集{options.Provider.ToDescription()}未找到"); var configType = assembly.GetTypes().FirstOrDefault(m => m.Name.Equals("ServiceCollectionConfig")); if (configType != null) { var instance = (IServiceCollectionConfig)Activator.CreateInstance(configType); instance.Config(services, options); } return(services); }
public ProjectController(IProjectService service, IOptionsMonitor <ModuleCommonOptions> commonOptions, IOptionsMonitor <CodeGeneratorOptions> codeGeneratorOptions) { _service = service; _commonOptions = commonOptions.CurrentValue; _codeGeneratorOptions = codeGeneratorOptions.CurrentValue; }
/// <summary> /// 添加模块 /// </summary> /// <param name="services"></param> /// <param name="environmentName">环境名称</param> /// <param name="moduleCommonOptions"></param> /// <returns></returns> public static IModuleCollection AddModules(this IServiceCollection services, string environmentName, out ModuleCommonOptions moduleCommonOptions) { moduleCommonOptions = null; var modules = new ModuleCollection(); services.AddSingleton <IModuleCollection>(modules); //通用配置 var cfg = new ConfigurationHelper().Load("module", environmentName, true); if (cfg == null) { return(modules); } var options = cfg.Get <ModuleCommonOptions>() ?? new ModuleCommonOptions(); if (options.UploadPath.IsNull()) { options.UploadPath = Path.Combine(AppContext.BaseDirectory, "Upload"); } if (options.TempPath.IsNull()) { options.TempPath = Path.Combine(AppContext.BaseDirectory, "Temp"); } services.AddSingleton(options); services.Configure <ModuleCommonOptions>(m => { m.UploadPath = options.UploadPath; m.TempPath = options.TempPath; }); moduleCommonOptions = options; foreach (var module in modules) { if (module == null) { continue; } services.AddApplicationServices(module); //加载模块配置项 var optionsConfigureType = module.AssemblyDescriptor.Infrastructure.GetTypes().FirstOrDefault(m => typeof(IModuleOptionsConfigure).IsAssignableFrom(m)); if (optionsConfigureType != null) { ((IModuleOptionsConfigure)Activator.CreateInstance(optionsConfigureType)).ConfigOptions(services, cfg.GetSection(module.Id)); } services.AddSingleton(module); } return(modules); }