开发者

Force the Opening of the DataContext's Connection (LINQ)

When you create a datacontext, its connection is closed until you retrieve objects a开发者_开发技巧nd it stays open when you retrieve objects in case you use deferred operators or late binding.

Is it possible (in an extension method of the datacontext of not) to force the datacontext to open its Connection without querying LINQ with LINQ or doing a fake query to the database with ExecuteQuery, ExecuteCommand, etc?

Thanks


You can use the DataContext.Connection property to retrieve the connection, and call Open() yourself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜