Example #1
0
        internal static void RegisterScaffoldRPackages(this Container container, CompositionRootSettings settings)
        {
            var packages = from assembly in AppDomain.CurrentDomain.GetAssemblies()
                           from type in assembly.GetSafeTypes()
                           where typeof(IPackageScaffoldR).IsAssignableFrom(type)
                           where !type.IsAbstract
                           select(IPackageScaffoldR) Activator.CreateInstance(type);

            packages.ToList().ForEach(p => p.RegisterServices(container, settings));
        }
Example #2
0
        /// <summary>
        /// Registers ScaffoldR into the Simple Injector container
        /// </summary>
        /// <param name="container">The Simple Injector Container object</param>
        /// <param name="compositionRootSettings">The Composition Root Settings</param>
        public static void RegisterScaffoldR(this Container container, Action <CompositionRootSettings> compositionRootSettings)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            if (compositionRootSettings == null)
            {
                throw new ArgumentNullException(nameof(compositionRootSettings));
            }

            var provider = new CompositionRootSettings();

            compositionRootSettings(provider);

            container.Options.AllowResolvingFuncFactories();
            container.RegisterScaffoldRPackages(provider);
        }