Webjedi
Webjedi

Reputation: 4737

Where to put a ViewModel factory in my ASP.NET MVC app?

I have a fairly complicated ViewModel associated with a product listing form, which has a lot of custom default values depending on the currently logged in user. I'm finding that populating it in my controller is quite a chore. So I'm thinking of creating a factory class for it, but I'm wondering where in the project structure it would be a best fit. In the Controllers folder?

Upvotes: 2

Views: 1036

Answers (1)

jamesaharvey
jamesaharvey

Reputation: 14281

I'd move it out into a separate Common or Core folder, or Common or Core project for that matter. If you can decouple the logic that's not specific to MVC, you'll probably be better off in the long run.

Upvotes: 1

Related Questions