且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 NHibernate ISqlExceptionConverter 的自定义异常

更新时间:2023-02-01 10:23:20

需要注册异常转换器.

在代码中:

configuration.SetProperty(
  Environment.SqlExceptionConverter,
  typeof(SqlExceptionConverter).AssemblyQualifiedName);

在配置文件中:

<property name="sql_exception_converter">
      Name.Space.SqlExceptionConverter, MyAssembly
</property>

我直到现在才尝试这个,只是在代码中查找.希望它有效,我也需要它:-)

I didn't try this until now, just looked in up in the code. Hope it works, I'll need it too :-)