예제 #1
0
 private void RegisterProviders(ContainerBuilder builder) =>
 ThisAssembly.GetReferencedAssemblies()
 .Where(a => a.Name.Contains("Providers"))
 .ToList()
 .ForEach(assemblyName =>
 {
     System.Reflection.Assembly.Load(assemblyName).GetTypes()
     .Where(a => a.Name.EndsWith("Provider"))
     .ToList()
     .ForEach(providerType => builder.RegisterType(providerType)
              .AsSelf()
              .PropertiesAutowired()
              .InstancePerRequest());
 });