asp.net mvc 2 - Linq to SQL and MVC 2 "Class member MyClass.MyProperty is unmapped. _COMPlusExceptionCode = -532462766 -


thanks in advance listening problem.

i have linq sql class, specific properties being displayed on grid use viewmodel.

firstly i'll paste part extentend class via partial class:

    public string owner { get; private set; }     public int32 documents { get; private set; }      partial void onloaded()     {         owner = "personcompanyrolemedicalexam";         documents = sfdb.storedfiles.count(s => s.owner == this.owner && s.ownerid == this.id);     } 

next ill paste viewmodel used grid:

public class medicalexamviewmodel {     public int32 id { get; set; }     public int32 personcompanyroleid { get; set; }     public int32? periodindays { get; set; }     public datetime? examcompleted { get; set; }     public bool? medicallyfit { get; set; }     public int32 documents { get; set; } } 

and lastly method ajax call grid populate it:

    [gridaction]     public actionresult _medicalexamgridajaxbinding(int32 id)     {         personcompanyrole personcompanyrole = db.personcompanyroles.single(p => p.personid == id);          var model = o in db.personcompanyrolemedicalexams                     o.personcompanyroleid == personcompanyrole.id                     select new medicalexamviewmodel                     {                         id = o.id,                         personcompanyroleid = o.personcompanyroleid,                         periodindays = o.periodindays,                         examcompleted = o.examcompleted,                         medicallyfit = o.medicallyfit,                         documents = o.documents                     };          return view(new gridmodel         {             data = model         });     } 

on line "var model = o in db.personcompanyrolemedicalexams" break after, looking @ object base {system.systemexception} = {"class member personcompanyrolesheappointment.documents unmapped."}

digging in deeper object exception system.systemexception, in innerexception states following: _complusexceptioncode = -532462766 .

the funny thing use exact same technique populate other objects / models in project without problems, there 1 difference though, , there linking table in between. this: person -> personcompanyrole > personcompanyrolemedicalexam. person personcompanyrole one-to-one relationship , personcompanyrole personcompanyrolemedicalexam one-to-many. completeness ill paste in ajax method dont exceptions.

    [gridaction]     public actionresult _incidentsgridajaxbinding(int32 id)     {         var structures = db.sp_getcompanystructuredecendants(id);         collection<companystructureincident> companystructureincidents = new collection<companystructureincident>();          foreach (sp_getcompanystructuredecendantsresult decendant in structures)         {             ienumerable<companystructureincident> equipment = db.companystructureincidents.where(r => r.companystructureid == decendant.id);             foreach (companystructureincident companystructureincident in equipment)             {                 companystructureincidents.add(db.companystructureincidents.single(p => p.id == companystructureincident.id));             }         }            var model = o in companystructureincidents                     //where o.companystructureid == id                     select new incidentviewmodel                     {                         id = o.id,                         companystructureid = o.companystructureid,                         dateofoccurence = o.dateofoccurence,                         datereported = o.datereported,                         documents = o.documents                     };          return view(new gridmodel         {             data = model         });     } 

hope can help.

i figured out, instead of using onload() this:

    public string owner     {         { return "personcompanyrolemedicalexam"; }     }      public int32 documents     {         { return sfdb.storedfiles.count(s => s.owner == this.owner && s.ownerid == this.id); }     } 

thanks anyways, hope else.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -