Linq to SQL not querying memory -
I was questioning results of a query that I memory'm using Linq to SQL and always thought . I have just seen the database and it is showing thousands of questions instead of 1, which I expected.
My approach has been to run a query and then use the linq to find within the resultset. / P>
IQueryable & lt; Mapping & gt; FieldList = db.mappings is equal to db.meta Join mm.secondaryMetaItemId miles mm Select mi.metaItemId db.meta meet objects mo.metaObjectId where mm.linkageId == 277 mm mi.metaObjectIbjects on; (Int i = 0; i & lt; 100; i ++) {for mapping thisVar = fieldList.FirstOrDefault (M = & gt; m.primaryItem == info.Name) for; }
How can I stop Linq to use my resultset every time ...
Thank you for your help!
The easiest way is that you can convert it to the list. This will put the results in memory as a list. You can then use it.
IQueryable & lt; Mapping & gt; FieldList = db.mappings is equal to db.meta Join mm.secondaryMetaItemId miles mm Select mi.metaItemId db.meta meet objects mo.metaObjectId where mm.linkageId == 277 mm mi.metaObjectIbjects on; // Help! Var result = field list. ToList (); // query results only once is processed // content (Inti I = 0; i & lt; 100; i ++) accumulated using {// result thisVar = result.FirstOrDefault (m = & Gt; m.primaryItem == info .name); }
Comments
Post a Comment