OrderByString enables string search parameters in LINQ OrderBy clauses

Here is something new to play with.  I just released a package that adds commands for OrderBy that take strings for property name and direction.


Usage is very flexible.  Here are some of the different ways to use the new commands:

 .OrderBy(“Property”).ThenBy(“OtherProperty”);
 .OrderBy(“Property desc”).ThenBy(“OtherProperty desc”);
 .OrderByDescending(“Property”)
       .ThenByDescending(“OtherProperty”);
 .OrderBy(“Property desc, OtherProperty asc”);
 .OrderBy(“Property, OtherProperty desc”);

Since these commands parse the strings and then call the standard IQueryable/IEnumerable commands for OrderBy and ThenBy, these commands will still work with your EntityFramework queries or any other LINQ queries.



Get or review the source at https://github.com/Grax32/OrderByString

Install the NuGet package from https://www.nuget.org/packages/OrderByString/

Home
Contact
Improve Your Life
Improve Your Team
Improve Your Code
Opinion
Software Projects

David Walker

David Walker is a Secure Software Consultant, a Certified Secure Software Lifecycle Professional (CSSLP), and a Professional Scrum Master. He believes in secure and reliable software and productive happy teams. He lives in Orlando with his lovely wife Lynn and his 2 dogs.