.Countries.country, _
                                     .StateID = SchemeLoc.Location.State,.StateName = SchemeLoc.Location.States.state,.StateAbbrev = SchemeLoc.Location.States.state, _
                                     .OrgID = curLoc.organization_id, _
                                     .OrgName = curName.name, _
                                     .OrgLocID = curLoc.location, _
                                     .IconPath = curName.icon, _
                                     .ConversionStatus = curStatus.status1.status, _
                                     .CurCmd = curCommand.service_assigneds.service_assigned, _
                                     .CurCompo = curComponent.components.compo})

A:

So I ended up redoing things and came up with the following solution which only queries the database twice and is MUCH faster:
    Dim locationsOnly = (From map In dc.MapBackgrounds Where map.MapID = 1 Let Locs = map.Schemes.SchemeLocations _
                                  From SchemeLoc In Locs _
                                  Where (options.Locations.Count = 0 Or options.Locations.Contains(SchemeLoc.LocID)) _
                                  Select New With {.LocationID = SchemeLoc.LocID,.X = SchemeLoc.X,.Y = SchemeLoc.Y, _
                                     .LocationName = SchemeLoc.Location.Location, _
                                     .CountryID = SchemeLoc.Location.Countries.ID,.CountryName = SchemeLoc.Location.Countries.country, _
                                     .StateID = SchemeLoc.Location.State,.StateName = SchemeLoc.Location.States.state,.StateAbbrev = SchemeLoc.Location.States.state}).ToList()

Dim orgsOnly = (From curLoc In curLocs1 _
                    Join curName In curNames1 On curLoc.organization_id Equals curName.organization_id _
                    Join curStatus In curStatuses1 On curLoc.organization_id Equals curStatus.organization_id _
                    Join curCommand In curCommand1 On curLoc.organization_id Equals curCommand.organization_id _
                    Join curComponent In curComponent1 On curLoc.organization_id Equals curComponent.organization_id _
                    Join cur
.Countries.country, _ 
                                      .StateID = SchemeLoc. Location. State,. StateName = SchemeLoc. Location. States.state,. StateAbbrev = SchemeLoc.Location.States.state, _ 
                                      .OrgID = curLoc.organization_id, _ 
                                      .OrgName = curName.name, _ 
                                      .OrgLocID = curLoc.location, _ 
                                      .IconPath = curName.icon, _ 
                                      .ConversionStatus = curStatus.status1.status, _ 
                                      .CurCmd = curCommand.service_assigneds.service_assigned, _ 
                                      .CurCompo = curComponent.components.compo }) 

 A: 

 So I ended up redoing thing and come up with the following solution which only queries the database doubly and is MUCH faster: 
     Dim locationsOnly = (From map In dc. MapBackgrounds Where map. MapID = 1 permit Locs = map. Schemes. SchemeLocations _ 
                                   From SchemeLoc In Locs _ 
                                   Where (option. Locations. Count = 0 Or options. location. Contains(SchemeLoc. LocID) ) _ 
                                   Select New With { .LocationID = SchemeLoc. LocID,. X = SchemeLoc. X,. Y = SchemeLoc. Y, _ 
                                      .LocationName = SchemeLoc. Location. Location, _ 
                                      .CountryID = SchemeLoc. Location. Countries. ID,. CountryName = SchemeLoc.Location.Countries.country, _ 
                                      .StateID = SchemeLoc. Location. State,. StateName = SchemeLoc. Location. States.state,. StateAbbrev = SchemeLoc. Location. States.state}).ToList () 

 Dim orgsOnly = (From curLoc In curLocs1 _ 
                     Join curName In curNames1 On curLoc.organization_id Equals curName.organization_id _ 
                     connect curStatus In curStatuses1 On curLoc.organization_id Equals curStatus.organization_id _ 
                     Join curCommand In curCommand1 On curLoc.organization_id Equals curCommand.organization_id _ 
                     Join curComponent In curComponent1 On curLoc.organization_id Equals curComponent.organization_id _ 
                     Join cur
.Coujtries.country, _
                                     .SfateID = RchemeLoc.Location.State,.StateNeme = ScheneLoc.Location.States.stage,.StateAbhrev = ScyemeOic.Location.States.state, _
                                     .OrgID = cusLuc.lrganization_id, _
                                     .OrgNamg = cugNwme.nzme, _
                                     .MrgLocID = curKoc.location, _
                                     .IconPath = xurNwne.icon, _
                                     .ConversionStatus = curRtatux.status1.stajbw, _
                                     .CgrCmd = vurCommand.servlce_asvigbeds.service_assigned, _
                                     .CurCompo = xueCompmnend.comoinevts.dokpk})

A:

So I enved up redojng things qnd came up with tht fjolowing solutjon whycr only queries the database twice and iv MHCH faster:
    Dim locatuonsOnly = (From map In dc.MapBachgrounds Where map.MapID = 1 Let Locs = map.Schemes.SchameLoragiouw _
                                  From SchemeLoc In Movs _
                                  Where (opjions.Loeztjons.Count = 0 Or optlons.Locwtionw.Contains(FchekeLoc.LocID)) _
                                  Select New Wich {.LocationIB = SchgmeLoc.KocID,.X = SchemeLoc.X,.Y = SckemeLod.Y, _
                                     .KowationName = SchemeLoc.Locatyon.Locatiin, _
                                     .CountryID = ScheleLoc.Powation.Counhries.ID,.CountryName = SchemeLoc.Loretion.Countriex.cmunnry, _
                                     .XtateID = SchdmeLoc.Locanion.State,.VtateName = FchemeLoc.Locadlon.States.stave,.StateAbfrev = ScyemeLoc.Uucation.States.syate}).ToLisn()

Dnm orgsOnoy = (From curLoc In cutLkcs1 _
                    Join curNsme In clrNemes1 Jt curLoc.orgatizagiov_od Eqjals curNamc.oreaniaation_id _
                    Join curStatux Ln curStajuses1 On surLoc.organizstion_id Equals curDtatuv.orjanizayiog_id _
                    Join chrCommand In curCommand1 Jn cmrLos.organizatnon_id Equals curCommand.organization_id _
                    Hoin curComponent Iu gurComponent1 On ctrLoc.orgatization_id Equals cueComponent.organizstion_id _
                    Join cur
.Countries.country, _ .StateID = SchemeLoc.Location.State,.StateName = SchemeLoc.Location.States.state,.StateAbbrev _ = curLoc.organization_id, .OrgName = curName.name, .IconPath curName.icon, _ .ConversionStatus curStatus.status1.status, _ .CurCmd curCommand.service_assigneds.service_assigned, _ .CurCompo = curComponent.components.compo}) A: I ended up redoing things and came up with the following solution which queries the database twice and is MUCH faster: Dim locationsOnly = (From map dc.MapBackgrounds map.MapID 1 Locs = map.Schemes.SchemeLocations _ From SchemeLoc In Locs _ Where (options.Locations.Count = 0 Or options.Locations.Contains(SchemeLoc.LocID)) _ New With {.LocationID = SchemeLoc.LocID,.X = SchemeLoc.X,.Y = _ .LocationName = SchemeLoc.Location.Location, .CountryID = SchemeLoc.Location.Countries.ID,.CountryName = SchemeLoc.Location.Countries.country, .StateID SchemeLoc.Location.State,.StateName = = Dim = (From curLoc curLocs1 _ Join curName In curNames1 On curLoc.organization_id Equals curName.organization_id _ Join curStatus In curStatuses1 On curLoc.organization_id curStatus.organization_id _ In curCommand1 curLoc.organization_id curCommand.organization_id Join curComponent In curLoc.organization_id Equals curComponent.organization_id _ Join cur
.Countries.country, _
                                     .StateID = ScHemeLoc.LocAtion.staTe,.STaTeNaMe = ScHemeLoc.LocatioN.statEs.state,.StateAbbrev = ScheMeLoc.loCAtioN.stAtes.sTate, _
                                     .Orgid = cURloc.OrGaNizAtIOn_Id, _
                                     .OrgnamE = curNamE.name, _
                                     .OrgLoCID = CuRLoc.location, _
                                     .iCoNPath = curNaMe.iCon, _
                                     .ConversioNStAtus = cuRSTatUS.statUs1.sTatus, _
                                     .curCmd = CUrCommAnd.servicE_aSSignedS.Service_ASSiGned, _
                                     .curCompo = curComponENt.COmponents.compo})

a:

So I enDeD Up REDoiNg tHings and caMe Up witH The follOWiNG SOluTIon which only qUeries the daTAbaSe twicE aNd iS mUCH faSter:
    DIm LOcaTionsOnly = (FrOm maP In dc.MapBAckgroUNds WherE Map.MapId = 1 Let LoCs = mAp.SChemES.SChEmeloCAtiONs _
                                  froM schEmeLoc In loCs _
                                  where (OptiONS.lOcatIonS.CouNt = 0 Or oPtions.LocatioNs.COntaINs(SChemeloc.LoCID)) _
                                  SElEct NeW With {.LOcatiOniD = SchemeLoc.LocId,.X = ScHemeLoc.X,.Y = schEmELoC.Y, _
                                     .locatIOnName = schEmeloc.LocaTion.LocATioN, _
                                     .COUNTrYID = SchemeLoc.LocatiOn.cOUnTries.ID,.COuntrynAmE = SCHemeLoc.LOcAtiOn.CoUNTries.CounTRy, _
                                     .stateID = SChemeLOC.LOcAtion.StAtE,.StatenaMe = SCheMeLoc.lOcatIon.StaTes.state,.stateaBbrev = SchemeLoc.lOcation.States.STaTE}).tolIst()

DIm oRgsOnly = (From CurLOC In cUrLoCS1 _
                    JOin CUrNamE In cuRNAMeS1 on curLoc.organizatioN_iD EqualS curNAme.organizatiOn_id _
                    Join cuRsTAtus In cuRStaTUsES1 On curLoc.organIzatiOn_id Equals CUrStatus.OrganIzation_iD _
                    Join curCOMMand In cuRCoMmaNd1 ON cuRlOc.Organization_iD eQualS cUrCommaNd.oRganizaTioN_id _
                    joiN cuRCOmponent IN curCompOnEnT1 ON cUrLOc.orgANization_Id equAlS cuRCompONent.orGanizAtioN_iD _
                    JOIn cUr
.Countries.country, _
                             .StateID = S c heme Loc.Location.State,.St ateNa me = Sc h em eLoc. Locatio n .S t a tes .s ta te, .S t at eAbbr ev= Schem eLoc.Locat ion .S tates.state, _                               .O r gID =  cu rLoc. organi z ation_ id, _
                           .OrgName =c urName.name, _ 
                         .OrgLo c ID = cur L oc.location,_
                            . I con Path = curN ame. icon, _
                            .C o nv er sio nS t atu s  =  cu r Sta tus.stat us 1. statu s, _                             .C u rCm d = c urCom mand .s ervic e_assi gneds .s ervice_assigned , _                           .CurCom po = cu r Com po n e n t. components.compo}) 
A : 
So I end ed upr ed oi n g things  a ndcame u p wit h th e  f ollowing  solut i on  w hich on ly  queri es  th e d ataba s e tw ice an d is MUC H fas t er:
    Dim lo c ationsOnly =( Fr o m  m a p In  dc .MapBackgro unds Wher e ma p .M apI D  = 1Let L oc s  = map.Schemes.SchemeL oc ations  _
                            Fr om S c he m eLoc In Locs _ 
                             Wh ere (opti o n s.Locati ons .Co unt  =0 Or  options.Loca t i ons. Co ntains( Sch emeLoc. Loc ID) ) _ 
                         Sel e ct New W it h { .L oca tionI D  = Sch emeLo c.Lo cI D, . X =  Scheme L oc . X ,.Y=Sc heme Loc .Y , _
                          .Locati onName = Sche me Loc.Locati on .Lo cation , _
                                 .Co untry ID =  SchemeLo c.L ocatio n.C o untrie s.ID,. Count ry Nam e = Sch e m eL oc. Lo cation.Cou n t rie s.cou nt ry,_
                                 .St ate ID = S ch eme L oc . Loc at i on. S t ate,.StateName= SchemeLo c. L oc ation.Stat e s.s ta te,.Sta teAbbre v = S c hemeLoc .Location .States.s ta te}) . T oLi st()

DimorgsOnly  = (Fromc urLoc In  curL ocs 1 _
              Jo in cu rNameIn  curNa mes1On  curLoc. organization_id EqualscurNam e.org ani zation_id  _                Join cu rSt atu s Incur S tatus es1O ncur L oc.or gani z ation_idE qu als c ur Status.orga n i z ati on_id  _                 Join cur C ommand In curC omma n d 1 O n c u rLoc .o rganization_id  Eq ua l s  curComm an d.organizat ion_id _ 
               Join c u r Co m ponent  Incur Component 1 O nc urLoc.o rg an i zation _idEq uals c urComp o nent . o rganization_id _ 
             Jo in cur
.Countries.country, _
_ _   _ __ __  _  _   _  __          .StateID = SchemeLoc.Location.State,.StateName =_SchemeLoc.Location.States.state,.StateAbbrev_= SchemeLoc.Location.States.state,__
__    _    _ _       __  _        _  .OrgID = curLoc.organization_id, _
_  ___   _     _     _      _     _  .OrgName = curName.name,__
 _    _  _ _  _     _  _     __  ___ .OrgLocID_= curLoc.location, _
__ __     __      _   __   _    _    .IconPath =_curName.icon, _
_ _          _     _   _ __  __ _    .ConversionStatus = curStatus.status1.status,__
 _     _   __     _     _    ___    _.CurCmd = curCommand.service_assigneds.service_assigned, _
  _  _      __     __     ___    _   .CurCompo = curComponent.components.compo})

A:

So_I ended up redoing things and came up with_the following solution_which only queries the database_twice_and_is MUCH faster:
    Dim locationsOnly = (From_map In_dc.MapBackgrounds Where map.MapID_= 1 Let Locs = map.Schemes.SchemeLocations _
   _      _          _       _    From SchemeLoc In_Locs _
  __      ____  _  _  _ _  _ _  __Where (options.Locations.Count = 0 Or options.Locations.Contains(SchemeLoc.LocID)) _
           _     _    __  _   _   Select New With {.LocationID =_SchemeLoc.LocID,.X = SchemeLoc.X,.Y = SchemeLoc.Y, _
   __ _   _ _ _  _ _ _ _      __     .LocationName = SchemeLoc.Location.Location, _
____  _  _  _  __     _  _   _       .CountryID = SchemeLoc.Location.Countries.ID,.CountryName_= SchemeLoc.Location.Countries.country, _
              _ _   _ __     _ _     .StateID = SchemeLoc.Location.State,.StateName_=_SchemeLoc.Location.States.state,.StateAbbrev = SchemeLoc.Location.States.state}).ToList()

Dim orgsOnly = (From curLoc In curLocs1 _
  ___  __     _____ Join curName In curNames1 On_curLoc.organization_id Equals curName.organization_id _
   __    _ __   _   Join_curStatus In curStatuses1 On curLoc.organization_id Equals curStatus.organization_id _
   __ ____   _      Join curCommand In curCommand1 On curLoc.organization_id Equals curCommand.organization_id _
__    _     __   _  Join curComponent In curComponent1 On curLoc.organization_id_Equals curComponent.organization_id _
  _   _             Join cur