They are all awesome. I decided to try Dynamic LINQ by adding it through Nuget. However, I soon found that Dynamic LINQ only support property names. In some cases, we want to be able to sort by specifying column attribute value, so I still use my own code which works just fine although it might not be optimized for performance.
For example in VB.NET:
Public Class Customer <Column c_name=""> Public Property Name As String <Column c_age=""> Public Property Age As Integer End Public Dim sortedByName = dbContext.Customers.AsEnumerable().SortBy("c_Name, c_Age DESC")
The gist for my code can be found in:
https://gist.github.com/nikyodo85/202fc2d417d9eb030d30896ccc862b7d
No comments:
Post a Comment