Bookstore.Application.Impl.ApplicationServices.BindAllInAssembly C# (CSharp) Метод

BindAllInAssembly() публичный Метод

public BindAllInAssembly ( Assembly assembly, Type type ) : void
assembly System.Reflection.Assembly
type System.Type
Результат void
        public void BindAllInAssembly(Assembly assembly, Type type)
        {
            foreach (var pair in assembly.GetExportedTypes()
            .Where(service => service.IsClass)
            .SelectMany(service => service.GetInterfaces().Select(@interface => new KeyValuePair<Type, Type>(service, @interface)))
            .Where(pair => pair.Value.IsGenericType && pair.Value.GetGenericTypeDefinition() == type))
              {
            Bind(pair.Value).To(pair.Key).InTransientScope();
              }
        }
ApplicationServices