Access nested properties with dynamic lambda using Linq.Expression

前端 未结 4 2504
说谎
说谎 2021-02-20 10:39

Let\'s assume that I have two classes:

class person
{
    int ID
    string name
    Address address
}
class address
{
    int ID
    string street
    string co         


        
4条回答
  •  梦毁少年i
    2021-02-20 11:25

    It seems to me you're trying to rewrite Microsoft DynamicQuery. Why not just use that instead?

    Here's an example:

    IQueryable myQuery = GetHibernateQuery();
    myQuery = myQuery.OrderBy("address.street");
    

提交回复
热议问题