Exemplo n.º 1
0
 public static void ConfigFromObject(this ContainerConfig containerConfig, AppDependenciesObject appDependecies)
 {
     containerConfig.AddServices(service =>
     {
         ConfigFromObjectInternal(service, appDependecies);
         service.StrictMode = appDependecies.StrictMode;
     });
 }
Exemplo n.º 2
0
        internal static void ConfigAddition(this IocContainer container, AppDependenciesObject appDependencies)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

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

            if (appDependencies.Addition != null)
            {
                foreach (var item in appDependencies.Addition)
                {
                    AdditionProcess.Process(item, container);
                }
            }
        }
Exemplo n.º 3
0
        private static void ConfigFromObjectInternal(ContainerOptions containerOptions, AppDependenciesObject dependencies)
        {
            // Add Root Assemblies
            var modules = dependencies.AppDependencies.Modules;

            containerOptions.Assemblies = modules == null || modules.Length == 0 ? null : modules;

            if (containerOptions.Assemblies != null)
            {
                // Add dependecies in hirarchy
                AddDependeciesRecursively(containerOptions, dependencies.AppDependencies.Dependencies);

                // Add Shared Dependencies
                if (dependencies.SharedDependencies != null && dependencies.SharedDependencies.Modules != null)
                {
                    containerOptions.AddSharedServices(shared =>
                    {
                        var sharedModules = dependencies.SharedDependencies.Modules;
                        shared.Assemblies = sharedModules == null || sharedModules.Length == 0 ? null : sharedModules;
                    });
                }
            }
        }