使用实体框架 (EF) 时如何查找通过 ODAC 发送到 Oracle 数据库的查询
我正在将 Oracle ODAC 用于 EntityFramework。我正在尝试使用实体框架开发示例 silverlight 应用程序。我已经添加了我的域服务,通过它我可以发布我的实体。我是 UI 的代码隐藏文件。我编写了以下代码。
var threemonthsold = DateTime.Now.AddMonths(-3);
var query = serverContext.GetSR_MERGED_DATAQuery().Where(t => t.SR_DATE_RECD > threemonthsold);
var regionLoadOp = serverContext.Load(query);
dataGrid.ItemsSource = regionLoadOp.Entities;
我想知道什么查询已发送到 oracle。由于操作超时,应用程序崩溃。看起来查询需要很长时间。如果我能找到查询,我可以直接在 Oracle 上运行它并找出它需要多长时间。
非常感谢任何帮助。
谢谢
I am using Oracle ODAC for EntityFramework. I am trying to develop a sample silverlight application using entityframework. I have add my domainservice through which I am publishing my entities. I am UI's code behind file. I have written the following code.
var threemonthsold = DateTime.Now.AddMonths(-3);
var query = serverContext.GetSR_MERGED_DATAQuery().Where(t => t.SR_DATE_RECD > threemonthsold);
var regionLoadOp = serverContext.Load(query);
dataGrid.ItemsSource = regionLoadOp.Entities;
I want to find out what query has been sent to oracle. As the operation is getting timedout the application is crashing. Looks like the query is taking long time. If I can find out the query I can run it directly on oracle and find out how long it is taking there.
Any help much appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您通过网络发送查询,Wireshark 是查看实际传输的数据包的好方法。如果您在数据包过滤器(不是捕获过滤器,而是主页上的过滤器,并且在无效/有效输入时变成红色/绿色)中输入
TNS
,您可以看到 Oracle 数据包。似乎没有没有维护的数据包解析器来显示数据包的不同部分数据包,但您可以查看数据字节并查看显示 SQL 语句的 ASCII 文本。 (您还会看到一堆会话打开/关闭垃圾。)
If you're sending queries across the network, Wireshark is a great way to view the actual packets being transferred. If you type
TNS
in for the packet filter (not the capture filter, but the one that's on the main page and turns red/green on invalid/valid input), you can see Oracle packets.It seems that there is no maintained packet dissector to show the different parts of the packet, but you can look at the data bytes and see ASCII text showing the SQL statements. (You'll also see a bunch of session open/close junk.)
在以下论坛中找到了此问题的答案。:
Found the answer for this question in the following forum.: