public static IExtendPipeline ReplaceRequestContext <TContext>(this IExtendPipeline bootstrapper) where TContext : class, IRequestContext, new() { return(bootstrapper.Extend((services, _) => { services.ReplaceFirst <IRequestContext, TContext>(ServiceLifetime.Transient); })); }
public static IExtendPipeline ConfigureMappings(this IExtendPipeline bootstrapper, Action <IMapperConfigurationExpression> mappingsConfiguration) { bootstrapper.Extend((services, _) => { services.AddSingleton <ITypeMapper>(c => { var componentResolver = c.GetService <IComponentResolver>(); return(new DefaultTypeMapper(mappingsConfiguration, componentResolver)); }); }); return(bootstrapper); }
public static IExtendPipeline ReplaceRequestContext <TContext>(this IExtendPipeline bootstrapper, Func <IServiceProvider, TContext> requestContextProvider) where TContext : class, IRequestContext { if (requestContextProvider == null) { throw new ArgumentNullException(nameof(requestContextProvider)); } return(bootstrapper.Extend((services, _) => { services.RemoveFirstOrNothing <IRequestContext>(); services.AddTransient <IRequestContext>(requestContextProvider); })); }