Jonathan
Jonathan

Reputation: 32898

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?

Upvotes: 6

Views: 1672

Answers (2)

Chris Fulstow
Chris Fulstow

Reputation: 41902

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.

Upvotes: 5

Shaun
Shaun

Reputation: 4177

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.

Upvotes: 2

Related Questions