Skip to main content

Posts

Showing posts from August, 2017

jQuery Datatable generic implementation on .Net/dotnet Core for any entity server filtering or sorting through EF/EF Core

jQuery Datatable is one of the popular freely available grid for the developers. It works really great on the client side but there is always need to write a lot of codes on the server side for filtering and sorting for each individual entities. In this article, we would address this by creating a generic implementation of server code which can work on any entity without writing any further piece of code for filtering and sorting. Just by calling a generic extension method it would resolve sorting and filtering. The key points to achieve it are as follows: - Model binding and provider to transform client side request to strongly typed item on the server. - Once we get strongly typed items to read values, we can apply a dynamic approach to generate queries and filters through LINQ expression. - At final part, just consumption of created mechanism by creating endpoints for each entity. Also, we can easily select required columns through LINQ projection. Model Binding As per Da