public object GetByName(string name)
        {
            ObjectionObject namedInstance = namedInstances[name] as ObjectionObject;

            if (namedInstance == null)
            {
                ObjectionType namedType = (ObjectionType)namedTypes[name];

                if (namedType == null)
                {
                    throw new ApplicationException("Unknown object name : " + name);
                }
                else
                {
                    return(Instantiate(namedType, name));
                }
            }
            else
            {
                if (namedInstance.Decorator != null)
                {
                    return(Instantiate(namedInstance.Decorator, name, namedInstance.Instance));
                }
                else
                {
                    return(namedInstance.Instance);
                }
            }
        }
 public DecoratableByType AddInstanceForName(string name, object instance)
 {
     namedInstances[name] = new ObjectionObject(instance);
     return((DecoratableByType)namedInstances[name]);
 }
Exemplo n.º 3
0
		public DecoratableByType AddInstanceForName(string name, object instance)
		{
			namedInstances[name] = new ObjectionObject(instance);
			return (DecoratableByType) namedInstances[name];
		}