Пример #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);
        }
Пример #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);
        }
Пример #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;
 }
Пример #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);
 }