last day (14 days later) » 

8:54 AM
1
A: What is better in this scenario? ViewBag or TempData or Session?

Lee GaryYou should not use any of those. Session are created per user, if you are storing 1000 - 5000 articles for each user using your search, you are going to have a bad time. ViewData are fundamentally Session object with a nice wrappers, so it's also bad for your use case. Let's say you decide to us...

 
When you say "query the database with pagination", how I can know how many records have matched my criteria?
 
I know this approach, but what is good ? Either to bring One extra column (for only one value) or Caching at .Net side?
 
You can nest your result from database to look something like this: { count: 2403, { your_result_object: { ... } }, if you know what i mean.. the idea of caching is good, but memory is limited and there's a big difference between application state, session, cache & view state. You might want to find out more of the difference between each of them
 
actually , I didn't got how to nest from SQL Result to {count:...}, can you please explain.
 
8:54 AM
i suggest you create a new question for that, as we are going off topic
 
Sure, but I am not clear what should be new question
 
are you using any ORM?
entity framework or something like that
 
no, ADO.NET & Stored Procedure
 
then how do you convert your data from ado.net to your DTO?
 
Currently I have used IList<Article>. Results of SP are converted to IList<Article>. In my View I have used MVC4 Pager. i.e. Ajax.Pager(..)
 
9:01 AM
so you have a class that is something like

public class Article { ... } ?
you can do this:

public class SearchResponse
{
int Count { get; set; }
List<Article> articles { get; set; }
}
 
yes
that is what clicking in my mind after discussing with you. will try this
Thank you so much friend!!!
 
no problem
 
if required then will trouble u again :)
 
sure
 

last day (14 days later) »