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); } } }
private object Instantiate(ObjectionType ObjectionType, string id, params object[] args) { object baseObject = Instantiate(ObjectionType.Type, id, args); ObjectionType decorator = ObjectionType.Decorator; if (decorator != null) { return(Instantiate(decorator, id, baseObject)); } else { return(baseObject); } }
public DecoratableByType Decorate(Type type) { decorator = new ObjectionType(type); return(decorator); }
public DecoratableByType Decorate(Type type) { decorator = new ObjectionType(type); return decorator; }
public DecoratableByType AddTypeForName(string name, Type type) { namedTypes[name] = new ObjectionType(type); return((DecoratableByType)namedTypes[name]); }
public DecoratableByType AddTypeForName(string name, Type type) { namedTypes[name] = new ObjectionType(type); return (DecoratableByType) namedTypes[name]; }
private object Instantiate(ObjectionType ObjectionType, string id, params object[] args) { object baseObject = Instantiate(ObjectionType.Type, id, args); ObjectionType decorator = ObjectionType.Decorator; if (decorator != null) return Instantiate(decorator, id, baseObject); else return baseObject; }