I am used to having static methods in the App_Code folder, this folder is no longer available in MVC template. These static methods I use all over the site.
How is it done in MVC, what is the best practice?
How do you call the common methods?
I am used to having static methods in the App_Code folder, this folder is no longer available in MVC template. These static methods I use all over the site.
How is it done in MVC, what is the best practice?
How do you call the common methods?
Typically I will have one or more class library projects in the same solution to hold auxiliary classes. Create your classes in a class library project, then reference that project's DLL in your MVC web application. The exception to this would be any models, actual or view-only. These could be put in the Models folder.
As @tvanfosson said have a different project and have all your class libraries there, but if you want to keep it simple you can create a Folder within your project and save all your .cs/.vb files inside the folder
My methods usually fall into 3 areas in MVC; business methods, controller flow, and presentation.
My business methods go in services, if there is global logic I consolidate it into a single service, maybe with a group of hidden services behind it.
For controller logic I create extension methods against Controller.
For presentation I create extension methods attached to the html helper and call them with <%= Html.MyCustomPresentationMethod() %>
I usually make a class called Utility that contains static methods that don't seem to fit anywhere else.
It depends on size of your app. For small app just create a folder and put your classes inside it; If you have a lot of classes - create separate project for them.