使用 NHibernate 3.x 的多个数据库
我找到了几篇如何将 NHibernate 与多个数据库一起使用的文章,例如这篇文章 http://codebetter.com/karlseguin/2009/ 03/30/using-nhibernate-with-multiple-databases/
但是所有文章都非常旧,并且可能有一些新的 NH 方法3.x?我查看了文档但没有找到任何东西,但也许我错过了一些东西?
有谁知道比本文中描述的更好的方法(本机 NH3.x 方法)来将 NH 3.x 与多个数据库一起使用? http://codebetter.com/karlseguin/2009/ 03/30/using-nhibernate-with-multiple-databases/
谢谢, 亚历山大.
I found a couple of articles how to use NHibernate with multiple database, for example this one
http://codebetter.com/karlseguin/2009/03/30/using-nhibernate-with-multiple-databases/
But all articles are very old, and may be there is some new approach with NH 3.x? I looked in documentation but did not found anything, but maybe i missed somthing?
Does anybody knows some better way (native NH3.x way) to use NH 3.x with multiple database than described in this article?
http://codebetter.com/karlseguin/2009/03/30/using-nhibernate-with-multiple-databases/
Thanks,
Alexander.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AFAIK,NH 3 中没有什么新内容。但是,与您链接的博客文章相比,使用多个数据库的选项仍然更多。
use database
语句)。AFAIK, there is nothing new in NH 3. But there are still more options to use several databases than in the blog post you linked.
use database
statement on sql server).您链接的文章仍然是要走的路。每个 SessionFactory 负责单个连接(连接字符串)和模式。
有一种特殊情况,您将数据库拆分为多个具有相同架构的数据库以实现负载平衡。这称为分片,并且有一个贡献 NHibernate.Shards 来处理它。
The articles you linked are still the way to go. Each SessionFactory is responsible for a single connection (connectionstring) and schema.
There is one special case where ou split the database into multiple with the same schema to load balance. This is called sharding and there is the contrib NHibernate.Shards to deal with it.