I'm following your typical Domain Driven Design tier design. I have:
Web
- Contains Views, and Controllers
ApplicationService
Facade to the application, i.e. service(s)
Contains view models
AutoMapper
Domain Model
- BLL
Repository
- Persistence logic
But since I'm using drop down lists in my Views, I'm confused how to incorporate the SelectListItem in this design. Note, drop down lists are populated with data from the database.
From what I've read, View Models should reside in the ApplicationService tier. Good theory, as the Web layer only "presentation", i.e. Views and Controllers and therefore can be replaced easily without re-designing the app.
BUT, this doesn't work when View Models are using SelectListItem (for drop down lists). SelectListItem requires System.Web.Mvc. And the ApplicationService layer I believe should not have a reference to System.Web.Mvc.
So, I'm stuck!
Either I give the ApplicationService layer a reference to System.Web.Mvc (ugly option).
Or I find a way how to populate drop down lists without SelectListItem.
Or I move the View Models back to the Web layer, which goes against the design.
And add another AutoMapper and related logic in the Web layer.
So, how are others implementing drop down lists logic in their multi-layered designs?