public static WrapperizerCqrsContextBuilder AddTransactionalCommands( this WrapperizerCqrsContextBuilder context) { context.ServiceCollection.Add( new ServiceDescriptor( typeof(IPipelineBehavior <,>), typeof(TransactionBehaviour <,>), context.ServiceLifetime)); return(context); }
public static WrapperizerCqrsContextBuilder AddDistributedCaching( this WrapperizerCqrsContextBuilder context) { context.ServiceCollection.Add( new ServiceDescriptor( typeof(IPipelineBehavior <,>), typeof(CacheBehaviour <,>) , context.ServiceLifetime)); return(context); }
public static IWrapperizerBuilder AddHandlers( this IWrapperizerBuilder builder, Action <WrapperizerCqrsContextBuilder> configure = null, ServiceLifetime serviceLifetime = Transient, params Assembly[] assemblies) { if (!assemblies.SafeAny()) { assemblies = GetListOfEntryAssemblyWithReferences(); } var wrapperizerCoreServiceCollection = new WrapperizerCqrsContextBuilder(builder.ServiceCollection, serviceLifetime); configure?.Invoke(wrapperizerCoreServiceCollection); builder.ServiceCollection.AddMediatR(assemblies, configuration => configuration = wrapperizerCoreServiceCollection.ServiceLifetime switch { Singleton => configuration.AsSingleton(), Scoped => configuration.AsScoped(), _ => configuration.AsTransient() });