コード例 #1
0
 public SystemController(ISystemService systemService, IOptionsMonitor <ModuleCommonOptions> optionsMonitor, FileUploadHelper fileUploadHelper, MvcHelper mvcHelper)
 {
     _systemService    = systemService;
     _fileUploadHelper = fileUploadHelper;
     _mvcHelper        = mvcHelper;
     _options          = optionsMonitor.CurrentValue;
 }
コード例 #2
0
 public AttachmentController(IAttachmentService service, ILoginInfo loginInfo, FileUploadHelper fileUploadHelper, IOptionsMonitor <ModuleCommonOptions> iOptionsMonitor)
 {
     _service             = service;
     _loginInfo           = loginInfo;
     _fileUploadHelper    = fileUploadHelper;
     _moduleCommonOptions = iOptionsMonitor.CurrentValue;
 }
コード例 #3
0
 public AttachmentController(IAttachmentService service, ILoginInfo loginInfo, FileUploadHelper fileUploadHelper, ModuleCommonOptions moduleCommonOptions)
 {
     _service             = service;
     _loginInfo           = loginInfo;
     _fileUploadHelper    = fileUploadHelper;
     _moduleCommonOptions = moduleCommonOptions;
 }
コード例 #4
0
ファイル: AttachmentService.cs プロジェクト: idsyn/NetModular
 public AttachmentService(IAttachmentRepository repository, IAttachmentOwnerRepository ownerRepository, IOptionsMonitor <ModuleCommonOptions> moduleCommonOptionsMonitor, IMediaTypeRepository mediaTypeRepository, IMapper mapper)
 {
     _repository          = repository;
     _ownerRepository     = ownerRepository;
     _moduleCommonOptions = moduleCommonOptionsMonitor.CurrentValue;
     _mediaTypeRepository = mediaTypeRepository;
     _mapper = mapper;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 public ClassController(IClassService service, IOptionsMonitor <ModuleCommonOptions> commonOption, IOptionsMonitor <CodeGeneratorOptions> codeGeneratorOptions)
 {
     _service = service;
     _codeGeneratorOptions = codeGeneratorOptions.CurrentValue;
     _commonOptions        = commonOption.CurrentValue;
 }
コード例 #8
0
 public UserController(IUserService service, IOptionsMonitor <ModuleCommonOptions> optionsMonitor, FileUploadHelper fileUploadHelper)
 {
     _service          = service;
     _options          = optionsMonitor.CurrentValue;
     _fileUploadHelper = fileUploadHelper;
 }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
 public ProjectController(IProjectService service, IOptionsMonitor <ModuleCommonOptions> commonOptions, IOptionsMonitor <CodeGeneratorOptions> codeGeneratorOptions)
 {
     _service              = service;
     _commonOptions        = commonOptions.CurrentValue;
     _codeGeneratorOptions = codeGeneratorOptions.CurrentValue;
 }
コード例 #11
0
        /// <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);
        }