public Type GetImplementType(Type interfaceType) { if (IsRegisteredImplement(interfaceType)) { return(interfaceTable[interfaceType]); } throw IOCException.NotRegisteredException(interfaceType); }
public object GetSingleton(Type interfaceType) { if (IsRegisteredSingleton(interfaceType)) { return(singletonTable[interfaceType]); } throw IOCException.NotRegisteredException(interfaceType); }
public void RegisterSingleton <TInterface>(object value) { IOCException.CheckImplementedInterface <TInterface>(value.GetType()); if (IsRegisteredSingleton <TInterface>()) { singletonTable[typeof(TInterface)] = value; return; } singletonTable.Add(typeof(TInterface), value); }
public void Register <TInterface, TImplement>() { IOCException.CheckImplementedInterface <TInterface, TImplement>(); if (IsRegisteredImplement <TInterface>()) { interfaceTable[typeof(TInterface)] = typeof(TImplement); return; } interfaceTable.Add(typeof(TInterface), typeof(TImplement)); }