Esempio n. 1
0
 public virtual void Validate()
 {
     foreach (var constructType in _typeMap.Values)
     {
         Container.InstantiateExplicit(
             constructType, ValidationUtil.CreateDefaultArgs(ProvidedTypes.ToArray()));
     }
 }
Esempio n. 2
0
        public void AddServices(IServiceCollection collection)
        {
            Ensure.That(collection, nameof(collection)).IsNotNull();

            if (Service.IsSuccess)
            {
                throw new InvalidOperationException("The service has been already created.");
            }

            var loggerFactory = LoggerFactory.IfNone(() => new NullLoggerFactory());

            (Service = CreateService(loggerFactory)).BiIter(
                service => ProvidedTypes.Iter(type => collection.AddSingleton(type, service)),
                error => throw new ValidationException(error));
        }