Example #1
0
 /// <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;
 }
Example #2
0
 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);
 }