Beispiel #1
0
        public static Container CreateWithPlugins(object[] modules, IPlugin[] plugins)
        {
            var allPlugins = new IPlugin[plugins.Length + 2];

            Array.Copy(plugins, allPlugins, plugins.Length);
            allPlugins[plugins.Length]     = new CodegenPlugin();
            allPlugins[plugins.Length + 1] = new ReflectionPlugin();
            return(StilettoContainer.MakeContainer(null, new RuntimeAggregationPlugin(allPlugins), modules));
        }
Beispiel #2
0
        public static Container CreateWithLoaders(object[] modules, ILoader[] loaders)
        {
            var allLoaders = new ILoader[loaders.Length + 2];

            Array.Copy(loaders, allLoaders, loaders.Length);
            allLoaders[loaders.Length]     = new CodegenLoader();
            allLoaders[loaders.Length + 1] = new ReflectionLoader();
            return(StilettoContainer.MakeContainer(null, new RuntimeAggregationLoader(allLoaders), modules));
        }
Beispiel #3
0
        /// <summary>
        /// Creates a container with the given modules, of which at least one
        /// must be given.
        /// </summary>
        /// <param name="modules">
        /// One or more modules, which may be either a <see cref="Type"/> that
        /// is decorated with a <see cref="ModuleAttribute"/>, or an instance
        /// of such a type.
        /// </param>
        /// <returns>
        /// Returns a <see cref="Container"/> which satisfies the requirements
        /// of the given modules, if possible.
        /// </returns>
        public static Container Create(params object[] modules)
        {
            var plugins = ReflectionUtils.GetCompiledPlugins();

            plugins.Add(new CodegenPlugin());
            plugins.Add(new ReflectionPlugin());

            var plugin = new RuntimeAggregationPlugin(plugins.ToArray());

            return(StilettoContainer.MakeContainer(null, plugin, modules));
        }
Beispiel #4
0
        /// <summary>
        /// Creates a container with the given modules, of which at least one
        /// must be given.
        /// </summary>
        /// <param name="modules">
        /// One or more modules, which may be either a <see cref="Type"/> that
        /// is decorated with a <see cref="ModuleAttribute"/>, or an instance
        /// of such a type.
        /// </param>
        /// <returns>
        /// Returns a <see cref="Container"/> which satisfies the requirements
        /// of the given modules, if possible.
        /// </returns>
        public static Container Create(params object[] modules)
        {
            var loaders = ReflectionUtils.GetCompiledLoaders();

            loaders.Add(new CodegenLoader());
            loaders.Add(new ReflectionLoader());

            var loader = new RuntimeAggregationLoader(loaders.ToArray());

            return(StilettoContainer.MakeContainer(null, loader, modules));
        }