c# - The model item passed into the dictionary is of type 'MyType', but this dictionary requires a model item of type 'MyType' -
c# - The model item passed into the dictionary is of type 'MyType', but this dictionary requires a model item of type 'MyType' -
yes, went through questions similar titles. none of them seem match situation i'm in. it's programmer sending wrong object type view.
this exact error message i'm receiving:
the model item passed dictionary of type 'is.extensions.models.contactselectlist', dictionary requires model item of type 'is.extensions.models.contactselectlist'.
i started moving around views , model classes in our solution in effort create 'framework-like'. mean views/models have used in multiple mvc applications , views/models specific mvc application. issue started áfter moving contactselectlist view. mutual views in project uses razor generator compile them.
i have in view:
@model is.extensions.models.contactselectlist
and when debugging can see model i'm sending renderpartial method of same type:
some sidenotes:
is mvc web app , references is.extensions is.extensions class library referenced is contactselectlist.cshtml located in is\views\controls the contactselectlist.cs model class located in is.extensions\models the 'parent view' (the view triggers renderpartial phone call situated in 'common' project: zmodel.web\views\controlsdoes have thought what's going on here? error messages kinda confusing , not help..
edit after erics comment:
the assembly containing model class (contactselectlist.cs) dynamically loaded. why? because thought makes sense create kind of extension / plugin system, dropping dll in directory extends mutual models application specific ones. how (slightly modified):
var zextenderassembly = assembly.loadfile(path); extendertype = zextenderassembly.gettypes().tolist().where(t => t.getinterface("izextender") != null).firstordefault(); homecoming (activator.createinstance(extendertype) izextender).createbo("contactselectlist");
the 'createbo' method in zextender (implements izextender) creates new instance of contactselectlist (which in same library zextender, no reflection needed):
public component createbo(string name) { ... homecoming new contactselectlist(); ... }
i moved extension dll bin directory of web application , changed way dll loaded. used load specifying total path .dll file. loading extension dll using assembly.load('myassemblyname')
, made work before.
c# asp.net-mvc-3
Comments
Post a Comment