示例#1
0
 /// <summary>
 /// Registers any classes in assemblies indicated by the AssemblyFilter that
 /// - Is in an allowed namespace
 /// - Implements an interface the is also in an allowed namespace
 /// - Does not implement IWindsorInstaller
 /// - Is not marked with the DoNotInstallByConvention attribute
 /// - Contains the unprefixed name of the interface in its own name (DefaultInterfaces)
 /// </summary>
 /// <param name="container">An IWindsorContainer implementation</param>
 /// <param name="store">An IConfigurationStore implementation</param>
 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         Classes
         .FromAssemblyInDirectory(AssemblyFilters.GetFilter())
         .Where(t => ContainerReporter.AddType(t) &&
                IsInAllowedNameNamespace(t) &&
                t.GetInterfaces().Any(i => IsInAllowedNameNamespace(i)) &&
                !t.GetInterfaces().Contains(typeof(IWindsorInstaller)) &&
                !t.GetCustomAttributes(false).Where(a => a.GetType() == typeof(DoNotInstallByConventionAttribute)).Any())
         .WithServiceDefaultInterfaces()
         .Configure(c => c.Named(c.Implementation.Name)));
 }
示例#2
0
 /// <summary>
 /// Get Assembly Installers
 /// </summary>
 /// <returns>An IWindsorInstaller encapsulating the full set of assembly installers</returns>
 internal static IWindsorInstaller GetInstallers()
 {
     return(FromAssembly.InDirectory(AssemblyFilters.GetFilter()));
 }