MVC4 MEF Plugin System and strongly typed views -
i'm developping mef-based plugin system, in every dll file under ~/webplugins/ folder exports interface iplugininfo considered plugin.
public interface iplugininfo { string name { get; } string description { get; } string assemblyname { get; } string version { get; } plugintype plugintype { get; } guid pluginguid { get; } } besides interface export, every dll exports it's own controllers this:
namespace websettings.controllers { [export("groups", typeof(armcontroller))] [partcreationpolicy(creationpolicy.nonshared)] [armauthorize(roles = "websettings")] public class groupscontroller : armcontroller .... in main project have overrided defaultcontrollerfactory's createcontroller method, allows search needed controllers among mef exported.
public class armcontrollerfactory : defaultcontrollerfactory { public override icontroller createcontroller(requestcontext requestcontext, string controllername) { icontroller controller = null; try { controller = base.createcontroller(requestcontext, controllername); } catch { } if (controller == null) controller = pluginmanager.getinstance<armcontroller>(controllername); if (controller == null) throw new exception("controller not found!"); return controller; } } also, there overrided razorviewengine view location search paths. allows mvc search views in ~/webplugins/views/ folder.
so, seems okay, no. normal practice when controller-view pair uses model class pass data between them. in case of mef controller export mvc can't find model class, located in same dll controller exported. and, of cource, view compilation fails on stage , mvc returns ysod in complains can't find model's namespace.
the first idea export model classes too, can't find out exports.
how tell mvc use it? there known workaround problem?
Comments
Post a Comment