Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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);
 }