更新时间:2022-12-17 12:50:06
很好.答案无处不在.以下是我从经验以及与 SQL Compact 团队互动中了解到的信息:
Nice. The answers are all over the place. Here's what I know from experience and interacting with the SQL Compact team:
所以答案实际上是两者兼而有之.
So the answer, actually, is both.
编辑
对于那些感兴趣的人,可以在 OpenNETCF ORM 库 中查看有关其工作原理的一个很好的示例.默认情况下,该库会创建一个维护"连接,该连接保持打开状态并用于执行模式查询之类的操作.所有其他数据操作使用它们自己的连接.您还必须选择将库配置为在 Store 的生命周期内重复使用单个连接,或者每次接触 store 时都使用新连接.在我使用默认设置的所有项目中,性能和行为一直是***的(这就是我将其设为默认设置的原因).
For those interested, a good example of how this works can be seen in the OpenNETCF ORM library. The library, by default, creates a "maintenance" connection that remains open and is used for doing things like schema queries. All other data operations use their own connection. You also have to option to configure the library to reuse a single connection for the life of the Store, or to use a new connection every time it touches the store. Perfomance and behavior has always been best in all of my projects using the default (which is why I made it the default).