Store multi-type OrderBy expression as a property

前端 未结 4 2059
一向
一向 2020-12-15 12:57

In a generic abstract base class I\'m storing a couple of expressions used for ordering:

public Expression> OrderByString { get;          


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 13:12

    This is easy to do if you use the DynamicLinq library found at NuGet.org. This allows you to write queries like;

    db.People.Where("Id == 8");
    db.People.OrderBy("Created ASC");
    

    That way you can save or pass in your where clauses as strings. No fuss, no muss.

    http://nuget.org/List/Packages/DynamicLINQ

提交回复
热议问题