tags:

views:

20

answers:

2

I am using a SQL Server database in my current project. I was watching the MVC Storefront videos (specifically the repository pattern) and I noticed that Rob (the creator of MVC Storefront) used a class called Category and Product, instead of a database and I have notice that using LINQ-SQL or ADO.NET, that a class is generated. Is there an advantage to using a class over a database to store information? Or is it the other way around? Or are they even comparable?

A: 

A class is an object in .NET, a class may or may not contain methods for data access to a database. However they are not comparable or related.

Read hear about classes: http://www.devarticles.com/c/a/C-Sharp/Introduction-to-Objects-and-Classes-in-C-Sharp-Part-2/

Dustin Laine
+1  A: 

I think in this case, the Category and Product classes are wrappers that persist their data to the database when something is changed. The Entity Framework is a perfect example of that.

TJMonk15