JustAnotherDeveloper
JustAnotherDeveloper

Reputation: 3199

Where to store methods in MVC projects

In MVC3, where is the best place to store methods

I am currently racking up quite a bit of code in my HomeController and feel that my methods should be seperate from the controller logic.

Should I create a model with a class of "HomeControllerMethods" or something?

Upvotes: 0

Views: 331

Answers (3)

Dave Mateer
Dave Mateer

Reputation: 6626

Here is an answer https://codereview.stackexchange.com/questions/981/not-feeling-100-about-my-controller-design discussing a similar topic.

Another great resource is www.tekpub.com I've just gone through the ASP.NET MVC3 Real World series. This series goes along at a cracking pace, and Rob uses an Infrastructure folder similar to @tugberk's advice.

Upvotes: 1

tugberk
tugberk

Reputation: 58444

Definitely do not put them inside your controllers if they are not specific to a controler and if they don't use the properties or methods of that controller.

Put them some other place. Where you need to put them is up to you. I always create another project called MyApp.Infrastructure.

Upvotes: 2

Yurii Hohan
Yurii Hohan

Reputation: 4171

Well, application architecture is your own choice which must be dictated by your conrete use cases. Try reading about three tier pattern to begin with

Upvotes: 1

Related Questions