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)))))); }
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 )))); }
/// <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))))); }