I'm new in Asp.net MVC pattern. I used to develop website using asp.net web forms. I did research for hours about MVC and got a little understanding. But there're still some problems that keep confusing me.
(I decided to use Code First)
I have to display some pretty complex data, for my old project, i was using Stored Procedure, now i think i'm gonna change to LINQ, the questions are :
- Does it affect the performance ? I was having good performance with SP.
- How do i "define" the objects created by the query (in this case is the result set), should i define it in model classes ?
To be more specific, this is how i get things done in my old project, i have a class called ReportData (please note this is a mini-version, the actual class contains more properties) :
public class ReportData
{
public string CityID { set; get; }
public DateTime ResultDate { set; get; }
/// ...
// free fields
public int INT1 { set; get; }
public int INT2 { set; get; }
public int INT3 { set; get; }
public int INT4 { set; get; }
public string STR1{ set; get; }
public string STR2 { set; get; }
public string STR3 { set; get; }
public string STR4 { set; get; }
}
And everytime a Stored Procedure is executed, i put the result into this class, and build the HTML markup from this class :
foreach (ReportData r in listReportData)
{
// build html markup here
}
This way i can save a whole lot of works, i don't have to write code twice for any "same same" results. And it's running ok, but i have to change due to some circumstances.
Now when stepping into MVC world, i found it very confused and honestly i'm now lost with the controlers, models, and views stuffs.
I also read about some related topic which pops up when i was typing this question, but they seem doesn't help me much in my case, oh i'm too nerd to understand the answers!