| | |
| | | using Autofac; |
| | | using Autofac.Extras.DynamicProxy; |
| | | using log4net; |
| | | using Microsoft.Extensions.DependencyModel; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.LogHelper; |
| | | |
| | | namespace WIDESEA_Core.Extensions |
| | | { |
| | |
| | | //private static readonly ILog log = LogManager.GetLogger(typeof(AutofacModuleRegister)); |
| | | protected override void Load(ContainerBuilder builder) |
| | | { |
| | | var basePath = AppContext.BaseDirectory; |
| | | var cacheType = new List<Type>(); |
| | | |
| | | builder.RegisterType<LogAOP>(); |
| | | cacheType.Add(typeof(LogAOP)); |
| | | if (AppSettings.app("LogAopEnable").ObjToBool()) |
| | | { |
| | | cacheType.Add(typeof(LogAOP)); |
| | | } |
| | | |
| | | builder.RegisterGeneric(typeof(RepositoryBase<>)).As(typeof(IRepository<>)).InstancePerDependency();//注åä»å¨ |
| | | builder.RegisterGeneric(typeof(ServiceBase<,>)).As(typeof(IService<>)).InstancePerDependency();//注åæå¡ |
| | |
| | | { |
| | | try |
| | | { |
| | | assemblyList.Add(AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(library.Name))); |
| | | string path = Path.Combine(basePath, $"{library.Name}.dll"); |
| | | if (!File.Exists(path)) |
| | | { |
| | | var msg = $"{library.Name}.dll丢失ï¼å 为项ç®è§£è¦äºï¼æä»¥éè¦å
F6ç¼è¯ï¼åF5è¿è¡ï¼è¯·æ£æ¥ bin æä»¶å¤¹ï¼å¹¶æ·è´ã"; |
| | | //log.Error(msg); |
| | | throw new Exception(msg); |
| | | } |
| | | assemblyList.Add(Assembly.LoadFrom(path)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | .AsImplementedInterfaces() |
| | | .InstancePerLifetimeScope() |
| | | .PropertiesAutowired(); |
| | | |
| | | builder.RegisterType<RequestLogModel>().InstancePerLifetimeScope(); |
| | | } |
| | | } |
| | | } |