忽略 Castle ActiveRecord 连接失败
我正在使用 castle activerecord 将我的域对象保存到 SQL Server 数据库。如果由于某种原因数据库连接失败,我需要能够忽略它并继续程序的操作。
I am using castle activerecord to persist my domain objects to a sql server database. If for whatever reason the database connection fails i need to be able to ignore it and carry on with the opperation of the program.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法忽略连接错误。连接失败时该怎么办由您决定。例如,如果您查询某些 User 实体并且出现连接错误,NHibernate/ActiveRecord 应该返回什么?不可能弥补结果。
如果您遇到的是偶尔连接的场景,请参阅此问题。
You can't ignore connection errors. It's up to you to decide what to do in case of a connection failure. For example, if you query for some User entities and there's a connection error, what should NHibernate/ActiveRecord return? It can't possibly make up results.
If you're working with an occasionally connected scenario, see this question.