如何将 Oracle 的 ClientId 属性与 Enterprise Library 一起使用?
刚刚偶然发现了 Oracle 10g 及以上版本中提供的新 ClientId(又名 client_identifier)变量,并且很乐意将其合并到应用程序中以协助审计跟踪。
该应用程序使用生成的企业库 DAAB 基础层 (netTiers),该层连接到使用带有 EntLibContrib 的 ODP.NET 驱动程序,因此 CRUD 函数创建一个 OracleDatabase 对象,然后从中检索通用 DbCommand 对象 它
看起来 OracleConnection 类具有ClientId 属性,那么在该模式中获取 Connection 对象的最简洁方法是什么?我应该从我创建的每个 DbCommand 中获取连接并将其设置在那里,还是太过分了?
因为 EntLib 在幕后进行大部分连接管理,所以我不确定是否可以在 CRUD 函数之外的某个位置设置 ClientId 并期望它持续存在?
Just stumbled across the new ClientId (aka client_identifier) variable that is available in Oracle 10g onwards, and would love to incorporate that into an app to assist with audit trails.
The app is using a generated Enterprise Library DAAB based layer (netTiers) that is wired to use the ODP.NET drivers with EntLibContrib, so CRUD functions create an OracleDatabase object and then retrieve generic DbCommand objects from it
It looks like the OracleConnection class has the ClientId property, so what is the cleanest way to get to the Connection object within that pattern? Should I be grabbing the connection out of every DbCommand I create and setting it there, or is that overkill?
Because EntLib is doing much of the connection management behind the scenes, I'm not sure whether I can set the ClientId somewhere outside of the CRUD functions and expect it to persist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果连接是分部类,您可以实现一个触发器,每当连接状态更改为打开时,该触发器就会设置客户端 ID。
这就是我实现它的方式。
我不知道你是否可以使用其中的一部分:
If the connection is a partial class you can implement a trigger that sets the client id whenever the connection changes state to open.
That's the way I implemented it.
I don't know if you can use part of this: