I am re-starting a website in ASP.NET MVC and want to make sure I follow proper practices. To date, I've come across only one article that talks about the model in any great detail...(http://quickstarts.asp.net/previews/mvc/mvc_UnderstandingModel.htm).
My question is, would all of my business logic go into the model folder? To me, the model means more the classes that represent the data, not the additional classes for extracting the data, utility classes etc. Generally is the Model folder intended to
replace the App_Code folder? That article in the above link, I interpret as meaning it does. In my project, in general terms I plan to have...
- utilities
- extension classes for most classes
- DB classes/namespaces of Handler/DAO/DB format. I am using the Telerik ORM tool so I would assume these classes would go there also.
- Business Logic classes
So I guess all of these go into namespaces in the model folder?
If your model has ant serious amount of Business Login or DB access it is best practice to seperate thos into projects and call these Dlls from you controllers.
The Model folder is good for simple models but more complex systems shouldnt really use it at all.
Take a look at some of the MVC sample apps on the web for a better picture.
RobSil
Member
68 Points
136 Posts
newbie question: Proper Use of the Model
Dec 31, 2008 01:14 PM|LINK
Hey all,
I am re-starting a website in ASP.NET MVC and want to make sure I follow proper practices. To date, I've come across only one article that talks about the model in any great detail...(http://quickstarts.asp.net/previews/mvc/mvc_UnderstandingModel.htm).
My question is, would all of my business logic go into the model folder? To me, the model means more the classes that represent the data, not the additional classes for extracting the data, utility classes etc. Generally is the Model folder intended to replace the App_Code folder? That article in the above link, I interpret as meaning it does. In my project, in general terms I plan to have...
- utilities
- extension classes for most classes
- DB classes/namespaces of Handler/DAO/DB format. I am using the Telerik ORM tool so I would assume these classes would go there also.
- Business Logic classes
So I guess all of these go into namespaces in the model folder?
Thx,
Rob
srulyt
Participant
1073 Points
230 Posts
Re: newbie question: Proper Use of the Model
Dec 31, 2008 01:45 PM|LINK
If your model has ant serious amount of Business Login or DB access it is best practice to seperate thos into projects and call these Dlls from you controllers.
The Model folder is good for simple models but more complex systems shouldnt really use it at all.
Take a look at some of the MVC sample apps on the web for a better picture.
MVC storefront.
Oxite
RobSil
Member
68 Points
136 Posts
Re: newbie question: Proper Use of the Model
Dec 31, 2008 01:58 PM|LINK
Thanks for that pointer... I downloaded MVC storefront and will base my design on that... it's an excellent structure!
Cheers,
Rob