/// <summary> /// Update projections that match a filter by a provided value. /// </summary> /// <typeparam name="TMessage">A message type</typeparam> /// <typeparam name="TProjection">A projection type</typeparam> /// <typeparam name="TValue">A type of projection property</typeparam> /// <param name="source">An argument builder that contains resulting mapper</param> /// <param name="projectionProperty">An expression that identifies a projection property</param> /// <param name="value">A value to filter by</param> /// <returns>An argument builder that contains resulting filter</returns> public static UpdateProjectionStrategyArguments <TMessage, TProjection> WhenEqual <TMessage, TProjection, TValue>( this UpdateProjectionStrategyArguments <TMessage, TProjection> source, Expression <Func <TProjection, TValue> > projectionProperty, TValue value) { source.Register(Filter <TMessage> .Create(projectionProperty, value)); return(source); }
/// <summary> /// Update projections that match a filter by a property from a message with the same name as in a projection. /// </summary> /// <typeparam name="TMessage">A message type</typeparam> /// <typeparam name="TProjection">A projection type</typeparam> /// <typeparam name="TValue">A type of projection property</typeparam> /// <param name="source">An argument builder that contains resulting mapper</param> /// <param name="projectionProperty">An expression that identifies a projection property</param> /// <returns>An argument builder that contains resulting filter</returns> public static UpdateProjectionStrategyArguments <TMessage, TProjection> WhenEqual <TMessage, TProjection, TValue>( this UpdateProjectionStrategyArguments <TMessage, TProjection> source, Expression <Func <TProjection, TValue> > projectionProperty) { PropertyInfo propertyInfo = ReflectionHelpers.GetMessagePropertyInfo <TMessage, TProjection, TValue>(projectionProperty); Func <TMessage, TValue> getValue = e => ReflectionHelpers.GetPropertyValue <TMessage, TValue>(e, propertyInfo); source.Register(Filter <TMessage> .Create(projectionProperty, getValue)); return(source); }