public void Remove(ObjectKey key, object value) { if (this.Items.ContainsKey(key)) { this.Items[key].Remove(value); } }
public void Add(ObjectKey key, object value) { if (this.Items.ContainsKey(key) == false) { this.Items.Add(key, new List<object>()); } this.Items[key].Add(value); }
public void AddRange(ObjectKey key,List<object> items) { if (this.Items.ContainsKey(key)) { this.Items[key].AddRange(items); } else { this.Items.Add(key, items); } }
public void AddRange(ObjectKey key, List <object> items) { if (this.Items.ContainsKey(key)) { this.Items[key].AddRange(items); } else { this.Items.Add(key, items); } }
public List<object> this[ObjectKey key] { get { if (this.Items.ContainsKey(key)) { return this.Items[key]; } else { return null; } } }
public List <object> this[ObjectKey key] { get { if (this.Items.ContainsKey(key)) { return(this.Items[key]); } else { return(null); } } }
private IEnumerable <object> ResolveInstances(ObjectKey key) { var list = this.ObjectPool[key]; if (list == null) { list = new List <object>(); foreach (var instance in ObjectContainer.CreateInstances(key.Type)) { list.Add(instance); } this.ObjectPool.AddRange(key, list); } return(list); }
private void RegisterInstance(ObjectKey key, object instance) { var list = Items[key]; if (list == null) { lock (key) { list = Items[key]; if (list == null) { list = new List <object>(); list.Add(instance); Items.AddRange(key, list); } } } list.Add(instance); }
private List <object> ResolveInstances(ObjectKey key) { var list = Items[key]; if (list == null) { lock (key) { list = Items[key]; if (list == null) { list = new List <object>(); foreach (var instance in ObjectContainer.CreateInstances(key.Type)) { list.Add(instance); } Items.AddRange(key, list); } } } return(Items[key]); }
public IEnumerable ResolveAll(Type type, string name) { var key = new ObjectKey(type, name); return(this.ResolveInstances(key)); }
public IEnumerable ResolveAll(Type type) { var key = new ObjectKey(type, null); return(ResolveInstances(key)); }
public object Resolve(Type type, string name) { var key = new ObjectKey(type, name); return(ResolveInstances(key).FirstOrDefault()); }
public void RegisterInstance(Type type, string name, object instance) { var key = new ObjectKey(type, name); this.ObjectPool.Add(key, instance); }
public T Resolve <T>(string name) { var key = new ObjectKey(typeof(T), name); return((T)ResolveInstances(key).FirstOrDefault()); }