简体   繁体   English

如何使用DAAB建立连接并保持连接?

[英]How to get a connection and hold it using DAAB?

I have a task ahead of me that requires the use of local temporary tables. 我前面还有一项任务,要求使用本地临时表。 For performance reasons I can't use transactions. 由于性能原因,我不能使用事务。

Temporary tables much like transactions require that all queries must come from one connection which must not be closed or reset. 与事务类似,临时表要求所有查询必须来自一个连接,该连接不得关闭或重置。 How can I accomplish this using Enterprise library data access application block? 如何使用企业库数据访问应用程序块来完成此任务?

Enterprise Library will use a single database connection if a transaction is active. 如果事务处于活动状态,则企业库将使用单个数据库连接。 However, there is no way to force a single connection for all Database methods in the absence of a transaction. 但是,在没有事务的情况下,无法对所有数据库方法强制执行单个连接。

You can definitely use the Database.CreateConnection method to get a database connection. 您绝对可以使用Database.CreateConnection方法来获取数据库连接。 You could then use that connection along with the DbCommand objects to perform the appropriate logic. 然后,您可以将该连接与DbCommand对象一起使用以执行适当的逻辑。

Other approaches would be to modify Enterprise Library source code to do exactly what you want or create a new Database implementation that does not perform connection management. 其他方法是修改企业库源代码以完全执行所需的操作,或者创建一个不执行连接管理的新数据库实现。

Can't see a way of doing that with DAAB. 看不到用DAAB做到这一点的方法。 I think you are going to have to drop back to use ADO.Net connections and manage them yourself, but even then, playing with temporary tables on the server from a client-side app doesn't strike me as an optimal solution to a problem. 我认为您将不得不退回去使用ADO.Net连接并自己管理它们,但是即使那样,从客户端应用程序在服务器上使用临时表也不能使我成为解决问题的最佳解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用DAAB处理动态连接字符串 - Handling a dynamic Connection String with DAAB 如何使用企业库DAAB批量插入很多行? - How to batch insert lots of rows using Enterprise Library DAAB? .Net企业库DAAB-使用访问器获取存储的Proc输出参数和返回值 - .Net Enterprise Library DAAB - Using Accessors to get Stored Proc Output params and Return values DAAB,我们需要手动处理关闭连接的问题吗? - DAAB, do we need to handle connection opening closing manually? 从EntLibContrib和DAAB EntLib 5.0使用Sqlite数据提供程序 - Using Sqlite Data Provider from EntLibContrib and DAAB EntLib 5.0 企业库DAAB 6和ODP.NET-默认数据库“ XXX”的连接字符串不存在 - Enterprise Library DAAB 6 and ODP.NET - Connection string for the default database 'XXX' does not exist 在C#控制台项目中使用企业库DAAB - Using Enterprise Library DAAB in C# Console Project 通过使用MS EntLib 4.1中的DAAB从oracle存储过程返回ref游标 - Returning ref cursor from oracle stored procedure by using DAAB from MS EntLib 4.1 无法执行从客户端(aspx页)到wcf服务的存储过程(使用DAAB) - could not execute a stored procedure(using DAAB) from a client(aspx page) to a wcf service 用于JAVA的企业库DAAB? - Enterprise Library DAAB for JAVA?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM