コード例 #1
0
 public static void Populate(this IDIContainer container, IServiceCollection services)
 {
     foreach (var service in services)
     {
         container.AddService(service);
     }
 }
コード例 #2
0
        public static void AddDependency <TInterface, TImplementation>(this IDIContainer container, ServiceLifetime lifetime = ServiceLifetime.Transient)
            where TInterface : class
            where TImplementation : class, TInterface
        {
            var service = new ServiceDescriptor(typeof(TInterface), typeof(TImplementation), lifetime);

            container.AddService(service);
        }