int getMaxValue<SomeEntity>(x => x.SomePropertyOfSomeEntity)
int getMaxValue<SomeEntity>(Expression<Func<SomeEntity, int>> SomePropertyOfSomeEntity)
{
var memberExpression = (MemberExpression)SomePropertyOfSomeEntity.Body;
var propertyInfo = (PropertyInfo)memberExpression.Member;
DBContext db = new DBContext();
//somehow convert property info and SomeEntity into this query, using db for the context
int maxValueOfProperty = (from x in db.SomeEntity
select x.SomePropertyOfSomeEntity).Max();
return maxValueOfProperty;
}