Exemplo n.º 1
0
 /// <summary>
 /// Responds to an event raised by a child configuration component by adding the raised type to the DI container
 /// controlled by this injector.
 /// </summary>
 private void TypeReferenced_EventHandler(object sender, TypeReferenceEventArgs e)
 {
     if (e?.Descriptor != null)
     {
         if (e.Required)
         {
             _serviceCollection.Add(e.Descriptor);
         }
         else
         {
             _serviceCollection.TryAdd(e.Descriptor);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Responds to an event raised by a child configuration component by adding the raised type to the DI container
 /// controlled by this injector.
 /// </summary>
 private void TypeReferenced_EventHandler(object sender, TypeReferenceEventArgs e)
 {
     _serviceCollection.TryAdd(new ServiceDescriptor(e.Type, e.Type, e.LifeTime));
 }