开发者

asp.net MVC Solution/Project layouts [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

开发者_如何转开发

Closed 3 years ago.

Improve this question

This is more of an open question rather than looking for one specific answer.

As we all know there is no one answer that fits all solutions but I am curious to find out how you structure you asp.net MVC solutions and any pitfalls you may have come across in your design or things that you would do differently if you could start again.

The standard asp.net MVC template is just a basic template and I'm sure I've read/heard in a podcast that Scott Hanselman stated the only reason the Model folder is there is so people didn't ask where's the model. This already implies that maybe it should be moved to its own separate class.

Personally in the small MVC apps I've done I've separated out the model into its only class that holds the model and the repository while the 'MVC' project has the controller and the views. This has generally workout without any issues but as I said these have only been small apps.

So what are most people doing? - Just using the standard template? - Separating out just the model? - Separating out the model and the controller? - Separating out even move so all the data access is done through web services or some sort of data portal? - Or something totally different?

Finally how are people creating unit tests? Just one unit test class that test each of the projects or a unit test class for each project?


Personally I use Jimmy Bogard's approach: Organizing ASP.NET MVC solutions.


To be honest, most of the time I have found the standard template tidy enough for me to simply re-use it. I would say its really just down to your own particular organizing preferences.

If my model got really large I would definitely consider creating a separate class library project for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜