/// <summary> /// Add a property value 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 mapper</returns> public static IRegisterMappers <TMessage, TProjection> Add <TMessage, TProjection, TValue>( this IRegisterMappers <TMessage, TProjection> source, Expression <Func <TProjection, TValue> > projectionProperty) where TValue : IComparable <TValue> { PropertyInfo propertyInfo = ReflectionHelpers.GetMessagePropertyInfo <TMessage, TProjection, TValue>(projectionProperty); return(source.Add(projectionProperty, e => ReflectionHelpers.GetPropertyValue <TMessage, TValue>(e, propertyInfo))); }
/// <summary> /// Increment a property value in a projection /// </summary> /// <typeparam name="TMessage">A message type</typeparam> /// <typeparam name="TProjection">A projection type</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 mapper</returns> public static IRegisterMappers <TMessage, TProjection> Increment <TMessage, TProjection>( this IRegisterMappers <TMessage, TProjection> source, Expression <Func <TProjection, long> > projectionProperty) { return(source.Add(projectionProperty, e => 1)); }