0

daoレイヤーを参照するサービスレイヤーがあります。ninject の反転制御を使用して実装を結び付けます。

public class DaoA : IDaoA
{   
    private DaoA _dao;
    public void daoMethod() {
       //throw DBUpdate exception   
    }    
}


public class ServiceA : BaseService 
{   
    private DaoA _dao;
    public result methodA() {
       _dao.daoMethod();    
    }
}

try catchここで、ブロックを避けたいと思いdaoMethodます。.NET のクラスでメソッドBaseService をキャッチするのと同じように、この例外をキャッチする方法はありますか?OnExceptionAttribute

4

1 に答える 1

0

Yes, if you do not catch the exception in the DAO layer you can catch it in the services layer.

于 2013-01-16T19:11:09.453 に答える