public static void Register <T>(string serviceName, T obj) { if (!RegisteredServices.TryAdd(serviceName, obj)) { throw new Exception($"Service {serviceName} has already been registered."); } }
public static void Register(Type type, object obj) { var serviceName = GetServiceRegistrationName(type); if (!RegisteredServices.TryAdd(serviceName, obj)) { throw new Exception($"Service {serviceName} has already been registered."); } }