Adding a Using Statement To Dispose Linq DataContext in a Compiled Query -


i using compiled queries in linq sql. pretty standard stuff this:

public static readonly func<mydatacontext,int,ienumerable<mytype>> getsomestuff =  compiledquery.compile<mydatacontext,int,ienumerable<mytype>> ( (datacontext,userid) => (from u in dc.tabletype  u.userid == userid  select u) ); 

then later calling this:

using(var c = new mydatacontext()) {  var qr = mycompiledqueriesclass.getsomestuff(c,12345); //etc.. } 

what move using statement inside compiled query i'm stuck best way this. ideas?


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -