How to capture all SQL sent over Ado.Net(如何捕获通过 Ado.Net 发送的所有 SQL)
问题描述
我有一个同时使用 Entity Framework 和 Dapper 的应用程序.我想提供一个自定义记录器来注销通过 ado.net 连接发出的任何 sql.这样做的最佳方法是什么?
I have an application that uses both Entity Framework and Dapper. I would like to provide a custom logger to log out any sql that is issued over the ado.net connection. What is the best way of doing this?
或者,如果不容易做到,具体有哪些困难?
Alternately, if it's not easily possible what exactly are the difficulties?
推荐答案
ADO.NET 数据跟踪 为你工作?它插入 ETW,您可以从中粘合当前的日志记录系统.不过似乎不是很独立.
Would ADO.NET Data Tracing work for you? It plugs into ETW, from which you might be able to glue your current logging system. Doesn't seem much stand-alone though.
这篇关于如何捕获通过 Ado.Net 发送的所有 SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何捕获通过 Ado.Net 发送的所有 SQL
基础教程推荐
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 将数据集转换为列表 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 如果条件可以为空 2022-01-01
