コード例 #1
0
 protected override void Action(IConventionalContext context)
 {
     _types.FindAll(context.GetTypePredicate().Compile()).ForEach(
         t => context.Get <ICollection <IRegisterAssemblyServiceSelector> >("Service").ForEach(
             selector => selector.Select(t).ForEach(
                 s => context.Services.ReplaceOrAdd(ServiceDescriptor.Describe(s, t, context.GetOrAdd <IRegisterAssemblyLifetimeSelector>("Lifetime", new LifetimeSelector(ServiceLifetime.Transient)).Select(t))))));
 }
コード例 #2
0
 protected override void Action(IConventionalContext context)
 {
     context.Types.ForEach(
         t => context.Get <ICollection <IRegisterAssemblyServiceSelector> >("Service").ForEach(
             selector => selector.Select(t).ForEach(
                 s => context.Services.ReplaceOrAdd(
                     ServiceDescriptor.Describe(s, t,
                                                context.GetOrAdd <IRegisterAssemblyLifetimeSelector>("Lifetime",
                                                                                                     new LifetimeSelector(ServiceLifetime.Transient)).Select(t)),
                     t.GetAttribute <ReplaceServiceAttribute>()?.ReplaceService ?? false
                     ))));
 }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 protected override void Action(IConventionalContext context)
 {
     context.Types.ForEach(
         t => context.Services.Configure <EventBusOptions>(options => options.Handlers.Add(EventHandlerDescriptor.Describe(t, context.Get <IEventHandlerActivationTypeSelector>("HandlerActivationTypeSelector").Select(t)))));
 }