No Parameterless Constructor defined for - ViewModel with UOW

Posted by TheVillageIdiot on Stack Overflow See other posts from Stack Overflow or by TheVillageIdiot
Published on 2012-11-26T04:13:04Z Indexed on 2012/11/26 5:04 UTC
Read the original article Hit count: 186

Filed under:
|
|

I have a view model class which uses UnitOfWork to some database operations like fetching of items to create select lists and IPrincipal for some auditing (like modified by etc.). It cannot work without this UOW. I have configured my web site to use Ninject to inject UOW into Controllers. From controller I pass this UOW when creating view model. But when performing POST operation I am getting

No parameterless constructor defined for this object. 

I have few SelectList type of properties which I have excluded with Bind attribute.

How can I overcome this problem? Can I configure Ninject to create the objects of this type and make ModelBinder use it?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-4

Related posts about ninject