使用多个数据库服务器Nhibernate [英] using multiple databse server Nhibernate

查看:109
本文介绍了使用多个数据库服务器Nhibernate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用Nhibernate .net构建项目,那么在完成项目后我可以通过更改单个配置文件将一个数据库服务器切换到另一个数据库服务器吗?



如果它有可能然后我怎么做Nghibernae .NET。



i我正在开发项目,但我想在多个数据库服务器中使用相同的项目..在java hibernate中是可能的但是我想使用.NET平台。在Nhibernate .NET中也是如此。 ?

if i build project using Nhibernate .net then after completing project can i switch one database server to another database server only by changing single configuration file ?

if it is possible then how can i do by Nghibernae .NET.

i am developing project but i want to use same project in multiple database server.. is possible in java hibernate but i want to use .NET platform. so is it possible in Nhibernate .NET. ?

推荐答案

因此,基于来自美国的最新更新。

我的方法是下一步。

您可以创建通用存储库接口并将其用于基本 CRUD 操作,也可以将其与 UnityOfWork模式(例如提交所有受影响的实体)....



之后你可以实现特定的实体存储库通过继承通用repo接口并为具体的数据库架构调整每种类型的repo。

所以,例如在结果中你将拥有

DepartmentRepoSqlServer DepartmentRepoOracle ...依此类推。
thus, based on the latest updates from U.
My approach lies in next.
You might to create generic repository interface and leverage it for basic CRUD operation , also you can leverage it with conjunction of UnityOfWork pattern(for example to commit all affected entities)....

After that you might implement specific entity repositories by inherits that generic repo interface and adjust each type of repo for concrete Database architecture.
so, for example in a result you will have
DepartmentRepoSqlServer,DepartmentRepoOracle... and so on.


这篇关于使用多个数据库服务器Nhibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆