예제 #1
0
 public ExpandedUnions? TryExpandUnions(ConfigurationRegistry configuration)
 {
     ExpandedUnions? result = null;
     var startIndex = 0;
     for (var i = 0; i < contracts.Count; i++)
     {
         var contract = contracts[i];
         var union = configuration.GetContractsUnionOrNull(contract);
         if (union == null)
         {
             if (result != null)
                 result.Value.contracts[i - startIndex] = new[] {contract};
         }
         else
         {
             if (result == null)
             {
                 startIndex = i;
                 result = new ExpandedUnions
                 {
                     contracts = new string[contracts.Count - startIndex][],
                     unionedContracts = new List<UnionedContact>(1)
                 };
             }
             result.Value.unionedContracts.Add(new UnionedContact {children = union, parent = contract});
             result.Value.contracts[i - startIndex] = union.ToArray();
         }
     }
     return result;
 }
예제 #2
0
 public SimpleContainer(ConfigurationRegistry configurationRegistry, ContainerContext containerContext,
     LogError errorLogger)
 {
     Configuration = configurationRegistry;
     implementationSelectors = configurationRegistry.GetImplementationSelectors();
     dependenciesInjector = new DependenciesInjector(this);
     this.containerContext = containerContext;
     this.errorLogger = errorLogger;
 }
예제 #3
0
 public SimpleContainer(GenericsAutoCloser genericsAutoCloser, ConfigurationRegistry configurationRegistry,
     TypesList typesList, LogError errorLogger, LogInfo infoLogger,
     Dictionary<Type, Func<object, string>> valueFormatters)
 {
     Configuration = configurationRegistry;
     implementationSelectors = configurationRegistry.GetImplementationSelectors();
     this.genericsAutoCloser = genericsAutoCloser;
     this.typesList = typesList;
     dependenciesInjector = new DependenciesInjector(this);
     this.errorLogger = errorLogger;
     containerContext = new ContainerContext
     {
         infoLogger = infoLogger,
         typesList = typesList,
         valueFormatters = valueFormatters
     };
 }
            public ConfigurationRegistry Build(TypesList typesList, ConfigurationRegistry parent)
            {
                ApplyDynamicConfigurators(typesList);
                IConfigurationSource configurationSource = new SimpleConfigurationSource(configurations);

                if (parent != null)
                {
                    foreach (var p in parent.contractUnions)
                    {
                        if (!contractUnions.ContainsKey(p.Key))
                        {
                            contractUnions.Add(p);
                        }
                    }
                    implementationSelectors.AddRange(parent.implementationSelectors);
                    configurationSource = new MergingConfigurationSource(configurationSource, parent.configurations);
                }
                return(new ConfigurationRegistry(configurationSource, contractUnions, implementationSelectors));
            }
 static ConfigurationRegistry()
 {
     Empty = new ConfigurationRegistry(new SimpleConfigurationSource(new Dictionary<Type, ServiceConfigurationSet>()),
         new Dictionary<string, List<string>>(), new List<ImplementationSelector>());
 }
 public ConfigurationRegistry Build(TypesList typesList, ConfigurationRegistry parent)
 {
     ApplyDynamicConfigurators(typesList);
     IConfigurationSource configurationSource = new SimpleConfigurationSource(configurations);
     if (parent != null)
     {
         foreach (var p in parent.contractUnions)
             if (!contractUnions.ContainsKey(p.Key))
                 contractUnions.Add(p);
         implementationSelectors.AddRange(parent.implementationSelectors);
         configurationSource = new MergingConfigurationSource(configurationSource, parent.configurations);
     }
     return new ConfigurationRegistry(configurationSource, contractUnions, implementationSelectors);
 }
 static ConfigurationRegistry()
 {
     Empty = new ConfigurationRegistry(new SimpleConfigurationSource(new Dictionary <Type, ServiceConfigurationSet>()),
                                       new Dictionary <string, List <string> >(), new List <ImplementationSelector>());
 }
예제 #8
0
 private string[][] TryExpandUnions(ConfigurationRegistry configuration)
 {
     string[][] result = null;
     var startIndex = 0;
     for (var i = 0; i < Contracts.Count; i++)
     {
         var contract = Contracts[i];
         var union = configuration.GetContractsUnionOrNull(contract);
         if (union == null)
         {
             if (result != null)
                 result[i - startIndex] = new[] {contract};
         }
         else
         {
             if (result == null)
             {
                 startIndex = i;
                 result = new string[Contracts.Count - startIndex][];
             }
             result[i - startIndex] = union.ToArray();
         }
     }
     return result;
 }
 public ParseContext(ConfigurationRegistry.Builder builder, ILookup<string, Type> typesMap)
 {
     this.builder = builder;
     this.typesMap = typesMap;
 }