Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Old 07-06-2011, 10:38 AM MVC App Structure??
DmitryS's Avatar
Skilled Talker

Posts: 84
Trades: 0
Hi,
In need of some help. I am confused about how to layout my application structure. I have looked at open source apps but still confused as they each have different structures.
I am thinking to have a separate folder for Business Logic. Within that, i will have a class for lets say customerService. This class will contain all linq queries. I will then have another folder under Business Logic for data classes. In this i will have a class customer. This will contain the getters and setters.
I assume that the model folder will contain a CustomerModel.
So the structure will be
Business_Logic
------Data
--------------customer (getters and setters)
------DBAccess
--------------customerService (linq queries)

Model
------CustomerModel (????????)

Controller
-------CustomerController

View
-------Views here etc etc

Questions:
Am i headed in the wrong direction for the MVC application structure? Do I need a Business Logic folder?
If the above example is more or less correct, what functions will the CustomerModel hold? Will it literally just reference the Business Logic customerService class?
I can’t find any relevant material on the Internet. I am literally struggling in getting the structure correct.
__________________
»
Please login or register to view this content. Registration is FREE
for web developers
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
DmitryS is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-06-2011, 11:28 AM Re: MVC App Structure??
Average Talker

Posts: 17
Trades: 0
Generally I advice creating an entirely new class library for the business layer. You can easily do that and have it be in the same solution so it still shows up in visual studio next to the mvc project.

The setup you have for the Business Logic folder is ok. I tend to break it like so

Business Layer
-Entities //contains my model objects
-Interfaces
-DataAccess
-Services

In the asp.net mvc project I use the models folder to onnly hold ViewModels. Which are specific representations of your models only relevant to the web.

Also, my contrllers don't talk to the data access code in my business layer, instead the controller has an instance of service class that knows how to talk to the database. The advantage of this is that I can swap out dataaccess code without impacting the controller. This comes in really handy when creating unit tests.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
- lowest prices in uk for electronics
ca4nul is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to MVC App Structure??
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12198 seconds with 11 queries