【发布时间】:2010-03-08 20:02:17
【问题描述】:
在我的服务中,所有公开的方法都有:
try
{
// the method core is written here
}
catch(Exception ex)
{
Log.Append(ex);
}
一遍又一遍地重复它既无聊又丑陋。有没有办法避免这种情况?有没有更好的方法让服务即使发生异常也能正常工作,并继续将异常详细信息发送到Log 类?
【问题讨论】:
-
你是指什么样的服务? WCF、asmx、windows 服务?
标签: c# .net logging refactoring