6

What is the best way to organize a MVC2 web project (as complex as stackoverflow)? should i have everything in one project? if not, how should i separate the projects and folders?

2

3 Answers 3

4

There's no best way. There are good and bad ways. Having everything in the same project is definitely not a good way. Big projects should be separated in layers and each layer usually goes into a different assembly so that it can be reused in other projects. For example you could have Models, Data Access, Business Logic, Web.

Jeffrey Palermo has a series of posts about the onion architecture which is worth reading.

From performance standpoint it is considered a good practice to have less bigger assemblies than many smaller assemblies.

Sign up to request clarification or add additional context in comments.

Comments

2

Have a look at MVC Areas in MVC 2: http://msdn.microsoft.com/en-us/library/ee671793(VS.100).aspx

This is one way to organise code in larger projects.

Comments

0

I would start with a new ASP.NET MVC Project and then add a couple of more projects to your solution. I usually end up with:

MyProject
MyProject.Data
MyProject.Test

I normally put the generated classes from Subsonic (or other ORM tool) along with their repository classes in my .data project and my tests in the .test project. Apart from that, I use the main project as normal. Views in the Views folder, Models in the Models folder and so on.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.