dependency injection - Asp.net MVC 3 inject UserControl for TemplateHint -
is possible somehow leverage dependency injection in asp.net mvc 3 (using forms viewengine) inject usercontrols library? using mef load other stuff mvcapplication.
i need because want build system expandable type system. want type vendor able inject custom controls provided type. have custom metadataprovider knows how handle provided types (it sets modelmetadata.templatehint property).
the question can plug in mef, templatehint gets handled, , custom control dispalyed upon caling html.editorformodel
i can't think of way using current service locator infrastructure in mvc 3 beta. can think of 2 alternative appraoches though:
- have editor template instead of rendering html delegates custom controls , returns output.
- write own viewengine can perform lookups partial views (the paths of form "editortemplates/yourtypename" etc.) , return view knows how talk custom controls.
Comments
Post a Comment