I have viewmodel (say memberviewmodel) and ef model (say member). how do i translate from
> GetByProperty(Expression<Func<MemberViewModel, bool>> whereCondition)
to
> GetByProperty(Expression<Func<Member, bool>> whereCondition)
any ideas?
My service exposes the method GetByProperty(Expression> whereCondition) but then within the service, it calls the business object which exposes a method GetByProperty(Expression> whereCondition).
To convert
Expression<Func<MemberViewModel, bool>>toExpression<Func<Member, bool>>you’ll need to extend theExpressionVisitorclass. I’ve assumedMemberViewModelcontains only fields and properties.Memberof course needs to implement the same set of fields and properties. In this case the following should work:Before passing the predicate to the second method you can now convert it using the class above: