开发者

Mapping nhibernate to several databases that share schema but not data

I have multiple databases that should all be active at the same time. They share schema, but not the data.

AFAIK nhibernate use the class type to know what ma开发者_如何学运维pping and database it is connected to, right? So once it gets an object, it wouldn't know if it belongs to database a or b.

I think it's possible to solve this using inheritance, but it's a real pain as there are in around 10 different databases...

Any ideas how this might be solved using nhibernate (burrow)?

I found this, but it's not the same as that is just choosing a single database out of many. I need to have them open at the same time using distinct data.

I also looked at NHibernate.Shards, but that wont work either. This is legacy databases that cannot change.


If the mappings are the same for each of your databases I think that I would have an ISessionFactory instance per database, mapped using the same mappings, then you would get an ISession from the appropriate one to access the particular database

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜