Building a Simple Blog Engine with ASP.NET MVC and LINQ - Part 3
page 2 of 8
by Keyvan Nayyeri
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 24837/ 351

Data Model

Data model is one of the main three components of MVC pattern and is actually responsible to maintain the state. Data model retrieves data from data storage systems and passes the data to controllers. Often the state data is stored in database storage system and you can retrieve them in several ways.

ASP.NET MVC framework doesn't care about your storage system and all you need to do is pass your data to the controller classes somehow. This may be via lower level APIs of ADO.NET like DataReader or DataSet or via LINQ to SQL classes. Here for KBlog I'll use LINQ to SQL which will become common in the near future (if we don't consider it as something common for real world projects right now).

In general the data model is a proxy class that loads data as objects and can pass them to controller classes. For simplicity many developers prefer to use some extra helper classes that simplify the work with the data model and encapsulate the inner workings to some extent. You'll see this later in this article.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 2 and 7 and type the answer here:

User Comments

Title: Commentary   
Name: maria tere
Date: 4/22/2009 9:49:51 AM
Comment:
i think the example of LINQ to SQL is very poor, because the use of that class is more extensible.
Title: Busby SEO Test   
Name: info@gmail.com
Date: 12/22/2008 12:07:27 AM
Comment:
thank you very much
Title: Question   
Name: Michael
Date: 12/6/2008 6:31:47 AM
Comment:
Hi, how about if our sample url is '/2008/12/06/post-title-here' just like what Wordpress did, is it possible?
Title: Nevermind   
Name: Nick Kirkes
Date: 4/26/2008 7:07:31 PM
Comment:
Just realized I am missing the DBDataContext.
Title: context.Posts?   
Name: Nick Kirkes
Date: 4/26/2008 7:06:44 PM
Comment:
Thanks for the article.

I'm following your guidance, but I can't build as the "context.Posts" don't exist (same for categories). Am I missing something?
Title: anxiously awaiting...   
Name: Emiel
Date: 4/24/2008 3:06:02 AM
Comment:
Here's another one waiting for part 4...
When, when, WHEN?
Title: And the part 4?   
Name: lxx
Date: 4/17/2008 11:42:43 AM
Comment:
I wait for your next artical.Thanks.
Title: Reply to Mike   
Name: Keyvan Nayyeri
Date: 3/28/2008 8:53:51 AM
Comment:
Mike,

I'll send it to editorial team in the next three days so I expect it to be published in the next couple of weeks.
Title: Expectation?   
Name: Mike Mayers
Date: 3/28/2008 8:45:08 AM
Comment:
Is there any prevision about the release of the 4th part? Can't wait to see it. Very nice.
Title: Very good!!!!!   
Name: Marcelo
Date: 3/27/2008 4:35:06 PM
Comment:
Very good tutorial! Am waiting anxiously for the "View" part!!! Thank you.

Product Spotlight
Product Spotlight 






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 11/20/2009 11:28:21 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search