/// <summary> /// Remove projections. /// </summary> public static RemoveProjectionStrategyArguments <TMessage, TProjection> Remove <TMessage, TProjection>( this IMessageHandlingStrategyConfiguration <TMessage, TProjection> source ) where TProjection : class, new() { var arguments = new RemoveProjectionStrategyArguments <TMessage, TProjection>(); ((IContainMessageHandlingStrategyFactory <TMessage, TProjection>)source).SetFactory(() => { Filters <TMessage> filters = arguments.Filters; return(new RemoveProjectionStrategy <TMessage, TProjection>(filters)); }); return(arguments); }
/// <summary> /// Insert a new projection. /// </summary> public static AddNewProjectionStrategyArguments <TMessage, TProjection> AddNew <TMessage, TProjection>( this IMessageHandlingStrategyConfiguration <TMessage, TProjection> source ) where TProjection : class, new() { var arguments = new AddNewProjectionStrategyArguments <TMessage, TProjection>(); ((IContainMessageHandlingStrategyFactory <TMessage, TProjection>)source).SetFactory(() => { Mappers <TMessage, TProjection> mappers = arguments.Mappers; return(new AddNewProjectionStrategy <TMessage, TProjection>(mappers)); }); return(arguments); }
/// <summary> /// Translate a message into a series of other messages. /// </summary> public static IMessageHandlingStrategyConfiguration <TR, TProjection> Translate <TMessage, TProjection, TR>( this IMessageHandlingStrategyConfiguration <TMessage, TProjection> source, Func <TMessage, IEnumerable <TR> > translate ) where TProjection : class, new() { var container = new MessageHandlingStrategyFactoryContainer <TR, TProjection>(); ((IContainMessageHandlingStrategyFactory <TMessage, TProjection>)source).SetFactory(() => { IMessageHandlingStrategy <TR> strategy = container.Create(); return(new TranslateStrategy <TMessage, TR>(translate, strategy)); }); return(container); }