ServiceModule.cs 885 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using Autofac;
  6. using System.Reflection;
  7. using Autofac.Core;
  8. using EMISOnline.DataLogic;
  9. using EMISOnline.Utility;
  10. namespace EMISOnline.CommonLogic
  11. {
  12. public class ServiceModule : Autofac.Module
  13. {
  14. static int BusinessModuleIndex { get; set; }
  15. protected override void Load(ContainerBuilder builder)
  16. {
  17. //通用类型注册
  18. var blAssembly = typeof(BaseServices).Assembly;
  19. builder.RegisterAssemblyTypes(blAssembly)
  20. .Where(x => x.FullName.StartsWith("EMISOnline.CommonLogic") &&
  21. x.Name != "BaseServices" &&
  22. x.Name.EndsWith("Services"))
  23. .AsImplementedInterfaces()
  24. .PropertiesAutowired()
  25. .InstancePerLifetimeScope();
  26. }
  27. }
  28. }