예제 #1
0
        /// <summary>
        /// Scans the assembly containing specified type for types implementing <see cref = "IWindsorInstaller" />, instantiates using given <see cref = "InstallerFactory" /> and returns so that
        ///     <see cref = "IWindsorContainer.Install" /> can install them.
        /// </summary>
        /// <returns> </returns>
        public static IWindsorInstaller Containing(Type type, InstallerFactory installerFactory)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            var assembly = type.Assembly;

            return(Instance(assembly, installerFactory));
        }
예제 #2
0
        /// <summary>
        /// Scans assemblies in directory specified by <paramref name = "filter" /> for types implementing <see cref = "IWindsorInstaller" />, instantiates using given <see cref = "InstallerFactory" /> and
        /// returns so that <see cref = "IWindsorContainer.Install" /> can install them.
        /// </summary>
        /// <param name = "filter"> </param>
        /// <param name = "installerFactory"> </param>
        /// <returns> </returns>
        public static IWindsorInstaller InDirectory(AssemblyFilter filter, InstallerFactory installerFactory)
        {
            var assemblies = new HashSet <Assembly>(ReflectionUtil.GetAssemblies(filter));
            var installer  = new CompositeInstaller();

            foreach (var assembly in assemblies)
            {
                installer.Add(Instance(assembly, installerFactory));
            }
            return(installer);
        }
예제 #3
0
 public AssemblyInstaller(Assembly assembly, InstallerFactory factory)
 {
     if (assembly == null)
     {
         throw new ArgumentNullException(nameof(assembly));
     }
     if (factory == null)
     {
         throw new ArgumentNullException(nameof(factory));
     }
     this.assembly = assembly;
     this.factory  = factory;
 }
예제 #4
0
		public AssemblyInstaller(Assembly assembly, InstallerFactory factory)
		{
			if (assembly == null)
			{
				throw new ArgumentNullException("assembly");
			}
			if (factory == null)
			{
				throw new ArgumentNullException("factory");
			}
			this.assembly = assembly;
			this.factory = factory;
		}
예제 #5
0
 /// <summary>
 /// Scans the assembly containing specified type for types implementing <see cref = "IWindsorInstaller" />, instantiates using given <see cref = "InstallerFactory" /> and returns so that
 ///     <see cref = "IWindsorContainer.Install" /> can install them.
 /// </summary>
 /// <returns> </returns>
 public static IWindsorInstaller Containing <T>(InstallerFactory installerFactory)
 {
     return(Containing(typeof(T), installerFactory));
 }
예제 #6
0
        private static IWindsorInstaller ApplicationAssemblies(Assembly rootAssembly, InstallerFactory installerFactory)
        {
            var assemblies = new HashSet <Assembly>(ReflectionUtil.GetApplicationAssemblies(rootAssembly));
            var installer  = new CompositeInstaller();

            foreach (var assembly in assemblies)
            {
                installer.Add(Instance(assembly, installerFactory));
            }
            return(installer);
        }
예제 #7
0
 /// <summary>
 /// Scans assembly that contains code calling this method for types implementing <see cref = "IWindsorInstaller" />, instantiates using given <see cref = "InstallerFactory" /> and returns so that
 ///     <see cref = "IWindsorContainer.Install" /> can install them.
 /// </summary>
 /// <returns> </returns>
 public static IWindsorInstaller This(InstallerFactory installerFactory)
 {
     return(Instance(Assembly.GetCallingAssembly(), installerFactory));
 }
예제 #8
0
        /// <summary>
        /// Scans the assembly with specified name for types implementing <see cref = "IWindsorInstaller" />, instantiates using given <see cref = "InstallerFactory" /> and returns so that
        ///     <see cref = "IWindsorContainer.Install" /> can install them.
        /// </summary>
        /// <returns> </returns>
        public static IWindsorInstaller Named(string assemblyName, InstallerFactory installerFactory)
        {
            var assembly = ReflectionUtil.GetAssemblyNamed(assemblyName);

            return(Instance(assembly, installerFactory));
        }
예제 #9
0
 /// <summary>
 /// Scans the specified assembly with specified name for types implementing <see cref = "IWindsorInstaller" />, instantiates using given <see cref = "InstallerFactory" /> and returns so that
 ///     <see cref = "IWindsorContainer.Install" /> can install them.
 /// </summary>
 /// <returns> </returns>
 public static IWindsorInstaller Instance(Assembly assembly, InstallerFactory installerFactory)
 {
     return(new AssemblyInstaller(assembly, installerFactory));
 }
예제 #10
0
        /// <summary>
        /// Scans current assembly and all refernced assemblies with the same first part of the name for types implementing <see cref = "IWindsorInstaller" />, instantiates using given
        ///     <see cref = "InstallerFactory" /> and returns so that <see cref = "IWindsorContainer.Install" /> can install them.
        /// </summary>
        /// <param name = "installerFactory"> </param>
        /// <returns> </returns>
        /// <remarks>
        /// Assemblies are considered to belong to the same application based on the first part of the name. For example if the method is called from within <c>MyApp.exe</c> and <c>MyApp.exe</c> references
        ///     <c>MyApp.SuperFeatures.dll</c>, <c>mscorlib.dll</c> and <c>ThirdPartyCompany.UberControls.dll</c> the <c>MyApp.exe</c> and <c>MyApp.SuperFeatures.dll</c> will be scanned for installers, and other
        /// assemblies will be ignored.
        /// </remarks>
        public static IWindsorInstaller InThisApplication(InstallerFactory installerFactory)
        {
            var assembly = Assembly.GetCallingAssembly();

            return(ApplicationAssemblies(assembly, installerFactory));
        }
예제 #11
0
 public static IWindsorInstaller InThisApplication(Assembly rootAssembly, InstallerFactory installerFactory)
 {
     return(ApplicationAssemblies(rootAssembly, installerFactory));
 }