public void AddService(Type contract, Type concrete, ServiceLifetime lifeCycle, Func <Container, object> initializer, dynamic instance) { var success = ThreadControl.DoubleLock(_synclock, () => _builders.DoesNotContainKey(contract), () => AddBuilder(contract, concrete, lifeCycle, initializer, instance)); if (!success) { throw new IocRegistrationException( $"Type {contract.FullName}: has already been registered with this Ioc container"); } }