public DependencyProvider(DependenciesConfiguration configuration) { if (ValidateConfiguration(configuration)) { this._configuration = configuration; _stack = new ConcurrentStack <Type>(); } }
private bool ValidateConfiguration(DependenciesConfiguration dependenciesConfiguration) { foreach (Type dependences in dependenciesConfiguration.DependencesList.Keys) { if (dependences.IsValueType) { throw new ArgumentException("Config is not valid"); } } return(true); }
public DependencyProvider(DependenciesConfiguration config, bool singletonPolicy = false) { isSingleton = singletonPolicy; singletonObjects = new ConcurrentDictionary <Type, object>(); dependencies = new Dictionary <Type, List <Type> >(); foreach (var dependency in config.GetContent()) { Type dep = dependency.Key; var list = new List <Type>(); foreach (var impl in dependency.Value) { if ((dep.IsAssignableFrom(impl) && !impl.IsAbstract && !impl.IsInterface) || (dep.IsGenericTypeDefinition)) { list.Add(impl); } } if (list.Count != 0) { dependencies.Add(dep, list); } } }
public DependencyProvider(DependenciesConfiguration dependencies) { this.dependencies = dependencies; }
public DependencyProvider(DependenciesConfiguration configuration) { _configuration = configuration; _locker = new object(); _typesInGeneration = new List <Type>(); }