asp.net mvc - MVC SelectListItem in multi-layer design -


i'm following typical domain driven design tier design. have:

web

  • contains views, , controllers

applicationservice

  • facade application, i.e. service(s)

  • contains view models

  • automapper

domain model

  • bll

repository

  • persistence logic

but since i'm using drop down lists in views, i'm confused how incorporate selectlistitem in design. note, drop down lists populated data database.

from i've read, view models should reside in applicationservice tier. theory, web layer "presentation", i.e. views , controllers , therefore can replaced without re-designing app.

but, doesn't work when view models using selectlistitem (for drop down lists). selectlistitem requires system.web.mvc. , applicationservice layer believe should not have reference system.web.mvc.

so, i'm stuck!

either give applicationservice layer reference system.web.mvc (ugly option).

or find way how populate drop down lists without selectlistitem.

or move view models web layer, goes against design.

and add automapper , related logic in web layer.

so, how others implementing drop down lists logic in multi-layered designs?

application services shouldn't deal viewmodels. viewmodel presentation layer concept (hence name). contains stuff tailored display , don't want leak application space.

dependencies should go outside inside, viewmodel should depend on (be composed of / mapped from) whatever data structure exposed application service, not other way around.

see should service layer return view models mvc application?


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -