You can use OFFSET in newer versions of SQL Server. I would pass in the skip and take as parameters. Use the skip for the OFFSET and for the take, you can maybe use SELECT TOP @Take FROM... Haven't tried it though. Here is some info about OFFSET in SQL Server to help you. www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/paging-data-in-t-sql/
How to pass parameters for query for operation WHERE StatusOfProduct IN ("InStock", "Ordered") and count of parameter are different for each request and comes from UI filter? First request ("InStock", "Ordered"), another request - ("InStock", "Ordered", "OutOfStock"), third ("Ordered").
I don't think that would work as the SQL statement is sent to the database for querying. A DTO won't have any direct relationship with the database, so that's where it won't work.
Great.
How to create the pagination version of stored procedure ?
You can use OFFSET in newer versions of SQL Server. I would pass in the skip and take as parameters. Use the skip for the OFFSET and for the take, you can maybe use SELECT TOP @Take FROM...
Haven't tried it though. Here is some info about OFFSET in SQL Server to help you.
www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/paging-data-in-t-sql/
How to pass parameters for query for operation WHERE StatusOfProduct IN ("InStock", "Ordered") and count of parameter are different for each request and comes from UI filter? First request ("InStock", "Ordered"), another request - ("InStock", "Ordered", "OutOfStock"), third ("Ordered").
Thanks a lot for the useful video
Can we use DTO class instead of existing entity with FromSqlRaw ?
I don't think that would work as the SQL statement is sent to the database for querying. A DTO won't have any direct relationship with the database, so that's where it won't work.
😄 Promo>SM
???