开发者

How to display stack trace in UI?

I have a WPF application. My users wish to see what stored procedures/functions an event calls.

I mean how can I show the stack trace(of only which DB object getting called) in to the user in simple english ?

How开发者_开发技巧 could I approach this problem.


if you only want to show English text like stored procedure's names and other internal commands executed in your application I don't think the StackTrace/Frame are optimal.

if you already have a logging framework in place (NLog, Log4Net etc...), you could add a log.info whenever you call a stored printing out the stored name and db name for example, then in the UI if you plan to show some kind of monitoring or log window, or even simply the last one in the status bar, you can read those informative logs.


You can use the StackFrame class in System.Diagnostics within the event handler. You can find some examples of how to use the class in the MSDN link. Then it's just a matter of displaying a string to the UI.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜