public void AddByToken(object instance, string token) { if (this.instances.ContainsKey(token)) { this.instances.Remove(token); } IoCInstance item = new IoCInstance(instance); this.instances.Add(token, item); }
/// <summary> /// Gets the instance for a token from the dictionary, create a new one if not exists. /// </summary> /// <param name="token">The token.</param> /// <returns></returns> private object GetInstance(string token) { IoCInstance item; if (this.instances.ContainsKey(token)) { item = this.instances[token]; } else { item = new IoCInstance(this.GetNewInstance()); this.instances.Add(token, item); } return(item.Instance); }
/// <summary> /// Gets the instance for a token from the dictionary, create a new one if not exists. /// </summary> /// <param name="token">The token.</param> /// <returns></returns> private object GetInstance(string token) { IoCInstance item; if (this.instances.ContainsKey(token)) { item = this.instances[token]; } else { item = new IoCInstance(this.GetNewInstance()); this.instances.Add(token, item); } return item.Instance; }
public void AddByToken(object instance, string token) { if (this.instances.ContainsKey(token)) { this.instances.Remove(token); } IoCInstance item = new IoCInstance(instance); this.instances.Add(token, item); }