开发者

Is it possible to determine if a LinqToSql context was disposed?

I found no way to determine if a context was dis开发者_Go百科posed or not because it isn't set to null and it doesn't have a State property or something.


If you Dispose your DataContext this way...

using (CustomDataContext myDC = new CustomDataContext())
{
  //use myDC to do something
}

The variable referencing the datacontext instance goes out of scope at the same time as the instance is disposed - which means you don't have to keep track.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜