asp.net - Is there an overhead with tracking when using EF6.1 and if so how can I remove this? -
i have complex queries this:
var contents = await db.contents .where(q => q.contentstatusid == contentstatusid || contentstatusid == 0) .where(q => q.contenttypeid == contenttypeid || contenttypeid == 0) .where(q => q.createdby == contentcreatedby || contentcreatedby == "0") .where(q => q.modifiedby == contentmodifiedby || contentmodifiedby == "0") .where(q => q.subjectid == subjectid) .tolistasync();
i send results web api , not need tracking. ef automatically add tracking , if overhead not need. if there way can turn off tracking ?
yes there overhead. can use asnotracking() on iqueryable or dbset.
var contents = await db.contents .where(q => q.contentstatusid == contentstatusid || contentstatusid == 0) .where(q => q.contenttypeid == contenttypeid || contenttypeid == 0) .where(q => q.createdby == contentcreatedby || contentcreatedby == "0") .where(q => q.modifiedby == contentmodifiedby || contentmodifiedby == "0") .where(q => q.subjectid == subjectid) .asnotracking() .tolistasync();
Comments
Post a Comment