public bool Register(Type svcType, ObjectCreatorCallback callback, Scope scope = Scope.Singleton) { Guard.ThrowIfNull("svcType", svcType); Guard.ThrowIfNull("callback", callback); if (FindRegistration(svcType) == null) { var svcReg = CreateServiceRegistration(svcType, null, callback, scope); _registrations.Add(svcType, svcReg); return(true); } return(false); }
public bool Register <T>(ObjectCreatorCallback callback, Scope scope = Scope.Singleton) { return(Register(typeof(T), callback, scope)); }
private ServiceRegistration CreateServiceRegistration(Type svcType, object instance, ObjectCreatorCallback callback, Scope scope) { return(new ServiceRegistration() { ServiceType = svcType, Instance = instance, Callback = callback, Scope = scope, }); }