c# - My Fluent nHibernate application is not lazy loading -


i have application mapping class attached @ end of question.

however, when retrieve instance of class command:

        // not sql query. queries nhibernate object structure, object names, properties , forth         // must track c# code, irrespective of db names         iquery query = session.createquery(string.format( "from {0} c c.id = :id", table));         query.setstring("id", id.tostring());         ilist list = query.list();         if ( list.count > 0 )              return (wowobject) query.list()[0];         else                         return null;        

the application hangs every reference , references retrieved database.

what doing wrong? i've been stuck on problem week , no 1 on google appears have run issue this.

class:

    public sealed class creaturemap : classmap <creature>     {         public creaturemap()         {              table("creature");             lazyload();             id(x => x.id, "id");             map(x => x.name, "name_lang0");             map(x => x.armormulti, "acmulti");             map(x => x.age, "age");             map(x => x.alwaysitem0, "alwaysitem0");             map(x => x.alwaysitem1, "alwaysitem1");             map(x => x.alwaysitem2, "alwaysitem2");             map(x => x.attackbasetime, "attackbasetime");             map(x => x.attackcooldowntime, "attackcooldowntime");             map(x => x.attributemulti0, "attributemulti0");             map(x => x.attributemulti01, "attributemulti01");             map(x => x.attributemulti02, "attributemulti02");             map(x => x.attributemulti03, "attributemulti03");             map(x => x.attributemulti04, "attributemulti04");             map(x => x.auctionhouseid, "auctionhouseid");             map(x => x.bankerid, "bankerid");             map(x => x.basicammo, "basicammo");             map(x => x.battlegroundmapid, "battlegroundmapid");             map(x => x.battlemasterlistid, "battlemasterlistid");             map(x => x.binderid, "binderid");             map(x => x.caste, "caste");             map(x => x.classid, "class");             map(x => x.classification, "classification");             map(x => x.creaturefamily, "creaturefamily");             references(x => x.creaturemovementinfoid, "creaturemovementinfoid").notfound.ignore().lazyload();             references(x => x.creaturetype, "creaturetype").notfound.ignore().lazyload();             map(x => x.cursorname, "cursorname");             map(x => x.damageclass, "damageclass");             map(x => x.damageimmunity, "damageimmunity");             map(x => x.dmgmulti, "damagemulti");             references(x => x.defaultlootid, "defaultlootid").notfound.ignore().lazyload();             references(x => x.defaultlootid1, "defaultlootid1").notfound.ignore().lazyload();             references(x => x.difficultycreatureid0, "difficultycreatureid0").notfound.ignore().lazyload();             references(x => x.difficultycreatureid1, "difficultycreatureid1").notfound.ignore().lazyload();             references(x => x.difficultycreatureid2, "difficultycreatureid2").notfound.ignore().lazyload();             references(x => x.difficultycreatureid3, "difficultycreatureid3").notfound.ignore().lazyload();             references(x => x.displayid, "displayid").notfound.ignore().lazyload();             references(x => x.displayid1, "displayid1").notfound.ignore().lazyload();             references(x => x.displayid2, "displayid2").notfound.ignore().lazyload();             references(x => x.displayid3, "displayid3").notfound.ignore().lazyload();             map(x => x.displayprobability, "displayprobability");             map(x => x.displayprobability1, "displayprobability1");             map(x => x.displayprobability2, "displayprobability2");             map(x => x.displayprobability3, "displayprobability3");             map(x => x.dmgvariance, "dmgvariance");             references(x => x.combat, "dungeonencounterid").notfound.ignore().lazyload();             map(x => x.powermulti, "energymulti");             map(x => x.expansionid, "expansionid");             references(x => x.factionid, "factionid").notfound.ignore().lazyload();             map(x => x.fatalfalldist, "fatalfalldist");             map(x => x.flags, "flags");             map(x => x.flagsex, "flagsex");             map(x => x.flagsexb, "flagsexb");             map(x => x.flagsexc, "flagsexc");             map(x => x.flagsexd, "flagsexd");             map(x => x.gender, "gender");             references(x => x.gossipid, "gossipid").notfound.ignore().lazyload();             map(x => x.healthmodifier, "healthmodifier");             map(x => x.hpmulti, "hpmulti");             references(x => x.immunitiesid, "immunitiesid").notfound.ignore().lazyload();             references(x => x.interactconditionid, "interactconditionid").notfound.ignore().lazyload();             references(x => x.interactspellid, "interactspellid").notfound.ignore().lazyload();             map(x => x.internalname_flag, "internalname_flag");             map(x => x.internalname, "internalname_lang0");             map(x => x.killfactionadjustcap, "killfactionadjustcap");             references(x => x.killfactionadjustid, "killfactionadjustid").notfound.ignore().lazyload();             map(x => x.killfactionadjustmulti, "killfactionadjustmulti");             map(x => x.maxdamage, "maxdamage");             map(x => x.maxlevel, "maxlevel");             map(x => x.maxrangeddamage, "maxrangeddamage");             references(x => x.meleeonlystringidnum0, "meleeonlystringidnum0").notfound.ignore().lazyload();             references(x => x.meleeonlystringidnum1, "meleeonlystringidnum1").notfound.ignore().lazyload();             map(x => x.memo, "memo");             map(x => x.mindamage, "mindamage");             map(x => x.minimapblip, "minimapblip");             references(x => x.minimapblipconditionid, "minimapblipconditionid").notfound.ignore().lazyload();             map(x => x.minlevel, "minlevel");             map(x => x.minrangeddamage, "minrangeddamage");             references(x => x.mountcreatureid, "mountcreatureid").notfound.ignore().lazyload();             map(x => x.name_flag, "name_flag");             map(x => x.name1_flag, "name1_flag");             map(x => x.name1_lang0, "name1_lang0");             map(x => x.name2_flag, "name2_flag");             map(x => x.name2_lang0, "name2_lang0");             map(x => x.name3_flag, "name3_flag");             map(x => x.name3_lang0, "name3_lang0");             map(x => x.npcinteractions, "npcinteractions");             map(x => x.npcsoundid, "npcsoundid");             map(x => x.numhelpfulauras, "numhelpfulauras");             references(x => x.onkillquestclear0, "onkillquestclear0").notfound.ignore().lazyload();             references(x => x.onkillquestclear1, "onkillquestclear1").notfound.ignore().lazyload();             references(x => x.onkillquestcomplete0, "onkillquestcomplete0").notfound.ignore().lazyload();             references(x => x.onkillquestcomplete1, "onkillquestcomplete1").notfound.ignore().lazyload();             map(x => x.patch_id, "patch_id");             map(x => x.petitionid, "petitionid");             map(x => x.petitionitemlistid, "petitionitemlistid");             map(x => x.petpersonality, "petpersonality");             map(x => x.petspellsid, "petspellsid");             references(x => x.phasegroupid, "phasegroupid").notfound.ignore().lazyload();             references(x => x.phaseid, "phaseid").notfound.ignore().lazyload();             references(x => x.phaseshift, "phaseshift").notfound.ignore().lazyload();             map(x => x.phaseuseflags, "phaseuseflags");             references(x => x.pickpocketlootid, "pickpocketlootid").notfound.ignore().lazyload();             map(x => x.playerclass, "playerclass");             map(x => x.preferredammo, "preferredammo");             references(x => x.proxycreatureid, "proxycreatureid").notfound.ignore().lazyload();             references(x => x.proxycreatureid1, "proxycreatureid1").notfound.ignore().lazyload();             map(x => x.pvppoints, "pvppoints");             references(x => x.questgiverid, "questgiverid").notfound.ignore().lazyload();             references(x => x.radiid, "radiid").notfound.ignore().lazyload();             references(x => x.randomtext0, "randomtext0").notfound.ignore().lazyload();             references(x => x.randomtext1, "randomtext1").notfound.ignore().lazyload();             map(x => x.randomtext2, "randomtext2");             map(x => x.ranking, "ranking");             map(x => x.recordlocked, "recordlocked");             map(x => x.referenceflag, "referenceflag");             map(x => x.required_expansion, "required_expansion");             map(x => x.resistbonus0, "resistbonus0");             map(x => x.resistbonus1, "resistbonus1");             map(x => x.resistbonus2, "resistbonus2");             map(x => x.resistbonus3, "resistbonus3");             map(x => x.resistbonus4, "resistbonus4");             map(x => x.resistbonus5, "resistbonus5");             map(x => x.resistbonus6, "resistbonus6");             map(x => x.resistscale0, "resistscale0");             map(x => x.resistscale1, "resistscale1");             map(x => x.resistscale2, "resistscale2");             map(x => x.resistscale3, "resistscale3");             map(x => x.resistscale4, "resistscale4");             map(x => x.resistscale5, "resistscale5");             map(x => x.resistscale6, "resistscale6");             map(x => x.ridevehiclecreatureid, "ridevehiclecreatureid");             map(x => x.runspeed, "runspeed");             map(x => x.schoolimmunity, "schoolimmunity");             references(x => x.skinninglootid, "skinninglootid").notfound.ignore().lazyload();             references(x => x.spawnspellid, "spawnspellid").notfound.ignore().lazyload();             map(x => x.spellimmunity0, "spellimmunity0");             map(x => x.spellimmunity01, "spellimmunity01");             references(x => x.spellsid, "spellsid").notfound.ignore().lazyload();             map(x => x.startanimstate, "startanimstate");             map(x => x.stateimmunity0, "stateimmunity0");             map(x => x.stateimmunity01, "stateimmunity01");             map(x => x.stringid0, "stringid0");             map(x => x.stringid1, "stringid1");             references(x => x.stringidnum0, "stringidnum0").notfound.ignore().lazyload();             references(x => x.stringidnum1, "stringidnum1").notfound.ignore().lazyload();             map(x => x.targetframepriority, "targetframepriority");             map(x => x.taxinodeid, "taxinodeid");             map(x => x.template, "template");             map(x => x.title_flag, "title_flag");             map(x => x.title_lang0, "title_lang0");             references(x => x.trainerid, "trainerid").notfound.ignore().lazyload();             references(x => x.triggersid, "triggersid").notfound.ignore().lazyload();             references(x => x.vehiclerec, "vehicleid").notfound.ignore().lazyload();             references(x => x.vendoritemlist, "vendoritemlist").notfound.ignore().lazyload();             references(x => x.vendorlist0, "vendorlist0").notfound.ignore().lazyload();             references(x => x.vendorlist01, "vendorlist01").notfound.ignore().lazyload();             references(x => x.vendorlist02, "vendorlist02").notfound.ignore().lazyload();             references(x => x.vendorlist03, "vendorlist03").notfound.ignore().lazyload();             references(x => x.vendorlist04, "vendorlist04").notfound.ignore().lazyload();             references(x => x.vendorlist05, "vendorlist05").notfound.ignore().lazyload();             map(x => x.walkspeed, "walkspeed");             map(x => x.woweditlock, "woweditlock");             map(x => x.woweditlockuser, "woweditlockuser");             map(x => x.xpmulti, "xpmulti");         }     } } 

apparently, notfound.ignore() causes nhibernate eager-fetch referenced entity. can restructure code eliminate need notfound.ignore().

here couple of links shed light on this:

hope helps,
ben


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -