Database query filtering in ASP.Net core web api

I am creating a web API in ASP.net core for my angular frontend and right now I have implemented a filtering feature on my frontend page where the users can filter and sort the data using any field, with regex filters, and also allow the user to only show a number of elements on each page. the problem with this is that: every time I have to send all the data from my backend which won’t come in handy when I have a big database, so I must do the filtering, ordering, and paging on my backend depending on what the user requested from the front.
How’s this problem usually solved? are there known technics for doing this?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You have a lot of options for that:

  1. Use Dapper. It’s great solution for query, filter, arrange data.
    Link to documentation – Dapper documentation
  2. Use Entity Framework Core or other ORM. But first you need to create a model from your existing database.
    Link to documentation – EF Core documentation
  3. Use ADO.Net. It’s a proprietary way to access SQL database for .NET solutions. Link to documentation – ADO.Net docmentation

I hope it will help you to quick query and filter your data on backend side.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x