public void Register(Type TDependency, Type TImplementation, Implementation.LiveTimes liveTime = Implementation.LiveTimes.InstPerDep) { if (IsImpAbstract(TImplementation) || IsNotImplementDep(TDependency, TImplementation) || IsNotHavePublicConstructor(TImplementation)) { throw new ArgumentException("Incorrect TImplementation"); } if (!Dependenсies.ContainsKey(TDependency)) { Dependenсies.Add(TDependency, new List <Implementation>()); } if (Dependenсies[TDependency].Contains(new Implementation(TImplementation, liveTime))) { throw new ArgumentException("Such dependency is already registered"); } Dependenсies[TDependency].Add(new Implementation(TImplementation, liveTime)); }
public void Register <TDependency, TImplementation>(Implementation.LiveTimes liveTime = Implementation.LiveTimes.InstPerDep) { Register(typeof(TDependency), typeof(TImplementation), liveTime); }