private IClassFactory ChooseFactory(ICreationContext creationContext, Type[] parameterTypes) { if (parameterTypes.Length == 0) { if (noArgumentsFactory == null) { lock (configurationLock) if (noArgumentsFactory == null) { noArgumentsFactory = creationContext.BuildFactory(ObjectType, Type.EmptyTypes); } } return(noArgumentsFactory); } var types = new TypeArray(parameterTypes); IClassFactory factory; if ((factory = TryGetFactory(types)) == null) { lock (configurationLock) if ((factory = TryGetFactory(types)) == null) { if (factories == null) { factories = new Hashtable(); } factories.Add(types, factory = creationContext.BuildFactory(ObjectType, parameterTypes)); } } return(factory); }
private IClassFactory ChooseFactory(ICreationContext creationContext, Type[] parameterTypes) { if (parameterTypes.Length == 0) { if (noArgumentsFactory == null) { lock (configurationLock) { if (noArgumentsFactory == null) { noArgumentsFactory = creationContext.BuildFactory(ObjectType, Type.EmptyTypes); } } } return(noArgumentsFactory); } IClassFactory factory; if ((factory = TryGetFactory(parameterTypes)) == null) { lock (configurationLock) { if ((factory = TryGetFactory(parameterTypes)) == null) { if (factories == null) { factories = new ConcurrentDictionary <Type[], IClassFactory>(TypeArrayEqualityComparer.Instance); } factories[parameterTypes] = factory = creationContext.BuildFactory(ObjectType, parameterTypes); } } } return(factory); }