EntityFrameworkから呼んだストアドのPRINT文の結果を受け取る

コンテキストがctxだとするとこんなので受け取れる。

 var entityConnection = (EntityConnection)ctx.Connection;
 var sqlConnection = (SqlConnection)entityConnection.StoreConnection;
 sqlConnection.InfoMessage += (s, a) => Console.WriteLine(a.Message);

ふむ。SQL Serverでやってるので他のDBはしりません。