c# - Long query cause System.StackOverflowException -
i have long query in linq sql populate datagrid follows:
var query = c in dc.hotel_meals_tbls select new { code = c.hotelcodeprimary, countrycode = c.countrycode, citycode = c.citycode, hotelcode = c.hotelcode, stars = c.starcode, www = c.wwwcode, abf = c.abfcode, location = c.locationcode, currency = c.currencycode, codecode = c.hotelcode, no = c.nocode, hotelname = c.hotelname, hfrom = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._from, hto = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._to, hfrom2 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(1).take(1).first()._from, hto2 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(1).take(1).first()._to, hfrom3 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(2).take(1).first()._from, hto3 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(2).take(1).first()._to, hfrom4 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(3).take(1).first()._from, hto4 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(3).take(1).first()._to, hfrom5 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(4).take(1).first()._from, hto5 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(4).take(1).first()._to, hfrom6 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(5).take(1).first()._from, hto6 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(5).take(1).first()._to, hfrom7 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(6).take(1).first()._from, hto7 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(6).take(1).first()._to, hfrom8 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(7).take(1).first()._from, hto8 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(7).take(1).first()._to, hfrom9 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(8).take(1).first()._from, hto9 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(8).take(1).first()._to, hfrom10 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(9).take(1).first()._from, hto10 = c.hotelperiod_tbls.where(d => d.periodname.contains("high")).skip(9).take(1).first()._to, pfrom = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._from, pto = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._to, pfrom2 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(1).take(1).first()._from, pto2 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(1).take(1).first()._to, pfrom3 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(2).take(1).first()._from, pto3 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(2).take(1).first()._to, pfrom4 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(3).take(1).first()._from, pto4 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(3).take(1).first()._to, pfrom5 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(4).take(1).first()._from, pto5 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(4).take(1).first()._to, pfrom6 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(5).take(1).first()._from, pto6 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(5).take(1).first()._to, pfrom7 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(6).take(1).first()._from, pto7 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(6).take(1).first()._to, pfrom8 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(7).take(1).first()._from, pto8 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(7).take(1).first()._to, pfrom9 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(8).take(1).first()._from, pto9 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(8).take(1).first()._to, pfrom10 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(9).take(1).first()._from, pto10 = c.hotelperiod_tbls.where(d => d.periodname.contains("peak")).skip(9).take(1).first()._to, tpfrom = c.hotelperiod_tbls.where(d => d.periodname.contains("extrapeak")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._from, tpto = c.hotelperiod_tbls.where(d => d.periodname.contains("extrapeak")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._to, tpfrom2 = c.hotelperiod_tbls.where(d => d.periodname.contains("extrapeak")).skip(1).take(1).first()._from, tpto2 = c.hotelperiod_tbls.where(d => d.periodname.contains("extrapeak")).skip(1).take(1).first()._to, tpfrom3 = c.hotelperiod_tbls.where(d => d.periodname.contains("extrapeak")).skip(2).take(1).first()._from, tpto3 = c.hotelperiod_tbls.where(d => d.periodname.contains("extrapeak")).skip(2).take(1).first()._to, sfrom = c.hotelperiod_tbls.where(d => d.periodname.contains("shoulder")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._from, sto = c.hotelperiod_tbls.where(d => d.periodname.contains("shoulder")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._to, sfrom2 = c.hotelperiod_tbls.where(d => d.periodname.contains("shoulder")).skip(1).take(1).first()._from, sto2 = c.hotelperiod_tbls.where(d => d.periodname.contains("shoulder")).skip(1).take(1).first()._to, sfrom3 = c.hotelperiod_tbls.where(d => d.periodname.contains("shoulder")).skip(2).take(1).first()._from, sto3 = c.hotelperiod_tbls.where(d => d.periodname.contains("shoulder")).skip(2).take(1).first()._to, lfrom = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._from, lto = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).firstordefault(a => a.hotelcodeid == c.hotelcodeid)._to, lfrom2 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(1).take(1).first()._from, lto2 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(1).take(1).first()._to, lfrom3 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(2).take(1).first()._from, lto3 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(2).take(1).first()._to, lfrom4 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(3).take(1).first()._from, lto4 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(3).take(1).first()._to, lfrom5 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(4).take(1).first()._from, lto5 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(4).take(1).first()._to, lfrom6 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(5).take(1).first()._from, lto6 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(5).take(1).first()._to, lfrom7 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(6).take(1).first()._from, lto7 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(6).take(1).first()._to, lfrom8 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(7).take(1).first()._from, lto8 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(7).take(1).first()._to, lfrom9 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(8).take(1).first()._from, lto9 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(8).take(1).first()._to, lfrom10 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(9).take(1).first()._from, lto10 = c.hotelperiod_tbls.where(d => d.periodname.contains("low")).skip(9).take(1).first()._to, bf = c.breakfast, lun = c.lunch, din = c.dinner, _24dec = c._24dec, _31dec = c._31dec, room1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).roomname, sglh1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).sgl_highseason, dblh1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).dbl_highseason, tplh1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).tpl_highseason, sglp1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).sgl_peakseason, dblp1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).dbl_peakseason, tplp1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).tpl_peakseason, sgltp1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).sgl_toppeakseason, dbltp1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).dbl_toppeakseason, tpltp1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).tpl_toppeakseason, sgls1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).sgl_shoulderseason, dbls1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).dbl_shoulderseason, tpls1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).tpl_shoulderseason, sgll1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).sgl_lowseason, dbll1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).dbl_lowseason, tpll1 = c.hotelroom_tbls.firstordefault(a => a.hotelcodeid == c.hotelcodeid).tpl_lowseason, room2 = c.hotelroom_tbls.skip(1).take(1).first().roomname, sglh2 = c.hotelroom_tbls.skip(1).take(1).first().sgl_highseason, dblh2 = c.hotelroom_tbls.skip(1).take(1).first().dbl_highseason, tplh2 = c.hotelroom_tbls.skip(1).take(1).first().tpl_highseason, sglp2 = c.hotelroom_tbls.skip(1).take(1).first().sgl_peakseason, dblp2 = c.hotelroom_tbls.skip(1).take(1).first().dbl_peakseason, tplp2 = c.hotelroom_tbls.skip(1).take(1).first().tpl_peakseason, sgltp2 = c.hotelroom_tbls.skip(1).take(1).first().sgl_toppeakseason, dbltp2 = c.hotelroom_tbls.skip(1).take(1).first().dbl_toppeakseason, tpltp2 = c.hotelroom_tbls.skip(1).take(1).first().tpl_toppeakseason, sgls2 = c.hotelroom_tbls.skip(1).take(1).first().sgl_shoulderseason, dbls2 = c.hotelroom_tbls.skip(1).take(1).first().dbl_shoulderseason, tpls2 = c.hotelroom_tbls.skip(1).take(1).first().tpl_shoulderseason, sgll2 = c.hotelroom_tbls.skip(1).take(1).first().sgl_lowseason, dbll2 = c.hotelroom_tbls.skip(1).take(1).first().dbl_lowseason, tpll2 = c.hotelroom_tbls.skip(1).take(1).first().tpl_lowseason, room3 = c.hotelroom_tbls.skip(2).take(1).first().roomname, sglh3 = c.hotelroom_tbls.skip(2).take(1).first().sgl_highseason, dblh3 = c.hotelroom_tbls.skip(2).take(1).first().dbl_highseason, tplh3 = c.hotelroom_tbls.skip(2).take(1).first().tpl_highseason, sglp3 = c.hotelroom_tbls.skip(2).take(1).first().sgl_peakseason, dblp3 = c.hotelroom_tbls.skip(2).take(1).first().dbl_peakseason, tplp3 = c.hotelroom_tbls.skip(2).take(1).first().tpl_peakseason, sgltp3 = c.hotelroom_tbls.skip(2).take(1).first().sgl_toppeakseason, dbltp3 = c.hotelroom_tbls.skip(2).take(1).first().dbl_toppeakseason, tpltp3 = c.hotelroom_tbls.skip(2).take(1).first().tpl_toppeakseason, sgls3 = c.hotelroom_tbls.skip(2).take(1).first().sgl_shoulderseason, dbls3 = c.hotelroom_tbls.skip(2).take(1).first().dbl_shoulderseason, tpls3 = c.hotelroom_tbls.skip(2).take(1).first().tpl_shoulderseason, sgll3 = c.hotelroom_tbls.skip(2).take(1).first().sgl_lowseason, dbll3 = c.hotelroom_tbls.skip(2).take(1).first().dbl_lowseason, tpll3 = c.hotelroom_tbls.skip(2).take(1).first().tpl_lowseason, room4 = c.hotelroom_tbls.skip(3).take(1).first().roomname, sglh4 = c.hotelroom_tbls.skip(3).take(1).first().sgl_highseason, dblh4 = c.hotelroom_tbls.skip(3).take(1).first().dbl_highseason, tplh4 = c.hotelroom_tbls.skip(3).take(1).first().tpl_highseason, sglp4 = c.hotelroom_tbls.skip(3).take(1).first().sgl_peakseason, dblp4 = c.hotelroom_tbls.skip(3).take(1).first().dbl_peakseason, tplp4 = c.hotelroom_tbls.skip(3).take(1).first().tpl_peakseason, sgltp4 = c.hotelroom_tbls.skip(3).take(1).first().sgl_toppeakseason, dbltp4 = c.hotelroom_tbls.skip(3).take(1).first().dbl_toppeakseason, tpltp4 = c.hotelroom_tbls.skip(3).take(1).first().tpl_toppeakseason, sgls4 = c.hotelroom_tbls.skip(3).take(1).first().sgl_shoulderseason, dbls4 = c.hotelroom_tbls.skip(3).take(1).first().dbl_shoulderseason, tpls4 = c.hotelroom_tbls.skip(3).take(1).first().tpl_shoulderseason, sgll4 = c.hotelroom_tbls.skip(3).take(1).first().sgl_lowseason, dbll4 = c.hotelroom_tbls.skip(3).take(1).first().dbl_lowseason, tpll4 = c.hotelroom_tbls.skip(3).take(1).first().tpl_lowseason, room5 = c.hotelroom_tbls.skip(4).take(1).first().roomname, sglh5 = c.hotelroom_tbls.skip(4).take(1).first().sgl_highseason, dblh5 = c.hotelroom_tbls.skip(4).take(1).first().dbl_highseason, tplh5 = c.hotelroom_tbls.skip(4).take(1).first().tpl_highseason, sglp5 = c.hotelroom_tbls.skip(4).take(1).first().sgl_peakseason, dblp5 = c.hotelroom_tbls.skip(4).take(1).first().dbl_peakseason, tplp5 = c.hotelroom_tbls.skip(4).take(1).first().tpl_peakseason, sgltp5 = c.hotelroom_tbls.skip(4).take(1).first().sgl_toppeakseason, dbltp5 = c.hotelroom_tbls.skip(4).take(1).first().dbl_toppeakseason, tpltp5 = c.hotelroom_tbls.skip(4).take(1).first().tpl_toppeakseason, sgls5 = c.hotelroom_tbls.skip(4).take(1).first().sgl_shoulderseason, dbls5 = c.hotelroom_tbls.skip(4).take(1).first().dbl_shoulderseason, tpls5 = c.hotelroom_tbls.skip(4).take(1).first().tpl_shoulderseason, sgll5 = c.hotelroom_tbls.skip(4).take(1).first().sgl_lowseason, dbll5 = c.hotelroom_tbls.skip(4).take(1).first().dbl_lowseason, tpll5 = c.hotelroom_tbls.skip(4).take(1).first().tpl_lowseason, room6 = c.hotelroom_tbls.skip(5).take(1).first().roomname, sglh6 = c.hotelroom_tbls.skip(5).take(1).first().sgl_highseason, dblh6 = c.hotelroom_tbls.skip(5).take(1).first().dbl_highseason, tplh6 = c.hotelroom_tbls.skip(5).take(1).first().tpl_highseason, sglp6 = c.hotelroom_tbls.skip(5).take(1).first().sgl_peakseason, dblp6 = c.hotelroom_tbls.skip(5).take(1).first().dbl_peakseason, tplp6 = c.hotelroom_tbls.skip(5).take(1).first().tpl_peakseason, sgltp6 = c.hotelroom_tbls.skip(5).take(1).first().sgl_toppeakseason, dbltp6 = c.hotelroom_tbls.skip(5).take(1).first().dbl_toppeakseason, tpltp6 = c.hotelroom_tbls.skip(5).take(1).first().tpl_toppeakseason, sgls6 = c.hotelroom_tbls.skip(5).take(1).first().sgl_shoulderseason, dbls6 = c.hotelroom_tbls.skip(5).take(1).first().dbl_shoulderseason, tpls6 = c.hotelroom_tbls.skip(5).take(1).first().tpl_shoulderseason, sgll6 = c.hotelroom_tbls.skip(5).take(1).first().sgl_lowseason, dbll6 = c.hotelroom_tbls.skip(5).take(1).first().dbl_lowseason, tpll6 = c.hotelroom_tbls.skip(5).take(1).first().tpl_lowseason, room7 = c.hotelroom_tbls.skip(6).take(1).first().roomname, sglh7 = c.hotelroom_tbls.skip(6).take(1).first().sgl_highseason, dblh7 = c.hotelroom_tbls.skip(6).take(1).first().dbl_highseason, tplh7 = c.hotelroom_tbls.skip(6).take(1).first().tpl_highseason, sglp7 = c.hotelroom_tbls.skip(6).take(1).first().sgl_peakseason, dblp7 = c.hotelroom_tbls.skip(6).take(1).first().dbl_peakseason, tplp7 = c.hotelroom_tbls.skip(6).take(1).first().tpl_peakseason, sgltp7 = c.hotelroom_tbls.skip(6).take(1).first().sgl_toppeakseason, dbltp7 = c.hotelroom_tbls.skip(6).take(1).first().dbl_toppeakseason, tpltp7 = c.hotelroom_tbls.skip(6).take(1).first().tpl_toppeakseason, sgls7 = c.hotelroom_tbls.skip(6).take(1).first().sgl_shoulderseason, dbls7 = c.hotelroom_tbls.skip(6).take(1).first().dbl_shoulderseason, tpls7 = c.hotelroom_tbls.skip(6).take(1).first().tpl_shoulderseason, sgll7 = c.hotelroom_tbls.skip(6).take(1).first().sgl_lowseason, dbll7 = c.hotelroom_tbls.skip(6).take(1).first().dbl_lowseason, tpll7 = c.hotelroom_tbls.skip(6).take(1).first().tpl_lowseason, room8 = c.hotelroom_tbls.skip(7).take(1).first().roomname, sglh8 = c.hotelroom_tbls.skip(7).take(1).first().sgl_highseason, dblh8 = c.hotelroom_tbls.skip(7).take(1).first().dbl_highseason, tplh8 = c.hotelroom_tbls.skip(7).take(1).first().tpl_highseason, sglp8 = c.hotelroom_tbls.skip(7).take(1).first().sgl_peakseason, dblp8 = c.hotelroom_tbls.skip(7).take(1).first().dbl_peakseason, tplp8 = c.hotelroom_tbls.skip(7).take(1).first().tpl_peakseason, sgltp8 = c.hotelroom_tbls.skip(7).take(1).first().sgl_toppeakseason, dbltp8 = c.hotelroom_tbls.skip(7).take(1).first().dbl_toppeakseason, tpltp8 = c.hotelroom_tbls.skip(7).take(1).first().tpl_toppeakseason, sgls8 = c.hotelroom_tbls.skip(7).take(1).first().sgl_shoulderseason, dbls8 = c.hotelroom_tbls.skip(7).take(1).first().dbl_shoulderseason, tpls8 = c.hotelroom_tbls.skip(7).take(1).first().tpl_shoulderseason, sgll8 = c.hotelroom_tbls.skip(7).take(1).first().sgl_lowseason, dbll8 = c.hotelroom_tbls.skip(7).take(1).first().dbl_lowseason, tpll8 = c.hotelroom_tbls.skip(7).take(1).first().tpl_lowseason, civicnumber =c.number, street =c.street, district =c.district, city =c.city, country =c.country, tel =c.tel, fax =c.fax, totalroom =c.totalroom, roomfacilities =c.roomfacilities, restaurantbar =c.restaurant_bar, hotelfacilities =c.hotelfacilities, gm = c.hotelcontact_tbls.where(d => d.contacttype.contains("gm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).name, gmmobile = c.hotelcontact_tbls.where(d => d.contacttype.contains("gm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).mobile, gmdirecttel = c.hotelcontact_tbls.where(d => d.contacttype.contains("gm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).directtel, gmdirectfax = c.hotelcontact_tbls.where(d => d.contacttype.contains("gm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).directfax, gmemail = c.hotelcontact_tbls.where(d => d.contacttype.contains("gm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).email, directorfb = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dir")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).name, dirmobile = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dir")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).mobile, diremail = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dir")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).email, dos = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dos")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).name, dosmobile = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dos")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).mobile, dosemail = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dos")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).email, dosskype = c.hotelcontact_tbls.where(d => d.contacttype.startswith("dos")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).skype, sm = c.hotelcontact_tbls.where(d => d.contacttype.startswith("sm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).name, smmobile = c.hotelcontact_tbls.where(d => d.contacttype.startswith("sm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).mobile, smemail = c.hotelcontact_tbls.where(d => d.contacttype.startswith("sm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).email, smskype =c.hotelcontact_tbls.where(d => d.contacttype.startswith("sm")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).skype, rsvn = c.hotelcontact_tbls.where(d => d.contacttype.startswith("rsvn")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).name, rsvnmobile =c.hotelcontact_tbls.where(d => d.contacttype.startswith("rsvn")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).mobile, rsvnemail =c.hotelcontact_tbls.where(d => d.contacttype.startswith("rsvn")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).email, rsvnskype =c.hotelcontact_tbls.where(d => d.contacttype.startswith("rsvn")).singleordefault(a => a.hotelcodeid == c.hotelcodeid).skype, focpolicy = c.focpolicy, childpolicy = c.childpolicy, honeymoon = c.honeymoon, cancellationpolicy = c.cancellationpolicy, paymentterm = c.paymentterm, bankreference = c.bankreference, notes = c.note } but when compile visual studio 2010 receive error message:
an unhandled exception of type 'system.stackoverflowexception' occurred in anonymously hosted dynamicmethods assembly;{cannot evaluate expression because current thread in stack overflow state.}
i compiled query linqpad4 , there no errors, have idea message mean?
i recommend rewrite query make less memory allocating. look, in every line wrote:
c.hotelperiod_tbls.where(d => d.periodname.contains("high")) // equal lines of code here. i think main problem of query. try fill data not in 1 query or move query sql-layer. monster not live long , produce huge problems memory.
Comments
Post a Comment