1

I am getting reports that connection pooling is not working in the Subsonic orm when used with sql server on a remote machine. I'm not sure how they are monitoring this, maybe with the profiler.

Subsonic opens late, closes early as you are supposed to do in an orm layer, but is there any problem with the implementation that would cause too many connections?

4

4 回答 4

7

使用 SubSonic 时,有一种方法可以使连接保持打开状态。许多人认为,当您加载集合时,阅读器将为您关闭 - 但事实并非如此(一个类不应该在未经许可的情况下对另一个类进行操作)。正是出于这个原因,有一个名为“LoadAndCloseReader()”的方法。

如果你能发现更多,那就太好了。

于 2009-03-30T19:19:46.487 回答
1

Does this mean that SubSonic's connections are persistent by default?

于 2009-04-16T10:19:52.317 回答
1

我不确定早期版本,但在 2.1 中,AbstractList.Load() 已经使用包装在 using 语句中的 LoadAndCloseReader(rdr)。

于 2010-01-31T14:08:54.187 回答
0

这是我最近在遇到类似问题后才发现的。

正如 Rob 所说,它不应该这样使用:

MyTableCollection objCol = new MyTableCollection().Load();

它应该像这样使用:

MyTableCollection objCol = new MyTableCollection();
objCol.LoadAndCloseReader(MyTable.FetchAll());
于 2009-11-30T04:58:05.003 回答