Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do you put classes that are neither Controllers, Models, Helpers or ViewModels?

In an ASP.NET MVC application, what do you do when you have unique classes that aren't controllers, helpers or view-models?

For example, say you have a class of utilities that are useful for processing map/location data.

These utilities may be used by more than one controller.

Would you create a top-level folder/namespace for them and call it 'Maps' or something?

like image 822
Jonathan Avatar asked Oct 21 '09 00:10

Jonathan


2 Answers

Maybe a new top-level folder and namespace called Utilities, and add your utility classes here: ProjectName.Utilities.MapUtility

If you have a lot of utility type classes, consider moving them into their own separate project.

like image 178
Chris Fulstow Avatar answered Nov 15 '22 07:11

Chris Fulstow


I think a namespace named util will work here.

project.name.space.util project.name.space.domain.util

things like that.

I've seen this util domain usage a lot in the apache projects and in other areas as well so it's not a java or .net specific nomenclature.

like image 33
Shaun Avatar answered Nov 15 '22 08:11

Shaun