捕获存储过程的打印输出在.NET(不同型号!) [英] Capture Stored Procedure print output in .NET (Different model!)

查看:126
本文介绍了捕获存储过程的打印输出在.NET(不同型号!)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,这个问题有区别...

Basically, this question with a difference...

是否有可能捕获在.NET中TSQL存储过程的打印输出,使用实体框架?

Is it possible to capture print output from a TSQL stored procedure in .NET, using the Entity Framework?

在其他问题的解决方案不为我工作。它与从System.Data.SqlClient的连接类型但我使用从System.Data.EntityClient不具有一个的的InfoMessage 事件。 (当然,我可以只创建一个基于实体连接设置的SQL连接,但是preFER直接去做。)

The solution in the other question doesn't work for me. It works with the connection type from System.Data.SqlClient but I'm using the one from System.Data.EntityClient which does not have an InfoMessage event. (Of course, I could just create an SQL connection based on the Entity connection settings, but prefer to do it directly.)

推荐答案

事实上,确实如此,但由于EF不是SQL Server特定的,你要投它:

Actually, it does, but since the EF is not SQL Server specific, you have to cast it:

var sqlConn = (SqlConnection)Context.Connection.StoreConnection;

这篇关于捕获存储过程的打印输出在.NET(不同型号!)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆