c# - LINQ to SQL or some other option -
c# - LINQ to SQL or some other option -
i have linq sql classes single tables in database (ie, dragged , dropped table sql server object browser dbml design layout window). considering filtering table when fill view model observable collection so: (commented out, idea):
class observabledocuments : viewablecollection<document> { public observabledocuments(dataclasses1datacontext datadc) { foreach (document doc in datadc.documents)//.where(x => x.jobid == 1)) { this.add(doc); } } }
i wondering if optimal way handle filtering. linq sql wait until phone call before querying database, or entire table still pulled in datacontext.documents table, , adding ones want observablecollection? if latter, there improve way in linq sql filter results, or should move away framework?
using linq sql means applying linq operators on iqueryable<t>
added sql statement instead of using ienumerable<t>
applies operator on retreived result.
so when applying where
operator, in case, , using combination iqueryable<t>
enough. results populated if iterate on results or phone call tolist()
.
more information: using iqueryable linq
c# sql-server linq
Comments
Post a Comment