开发者

Implementing conditional fluent mapping according to db

开发者 https://www.devze.com 2023-02-08 10:47 出处:网络
I\'m working with 2 different DB\'s in my app, a big(oracle) one for the online mode and a small(sqlce) one for offline mode.

I'm working with 2 different DB's in my app, a big(oracle) one for the online mode and a small(sqlce) one for offline mode.

The problem is with the mappings, the id generation strategy is not the same, I need a custom implementation on the sqlce(something like sequences but for the negative directio开发者_如何学JAVAn).

How can I achieve this ability, without my mapping contain IF's


Instead of manually setting it, can you define a convention? Then you would just have one if, which convention to load at session factory config time. Or maybe none if the convention can examine all the way into which dialect is being used (though I don't know if the fluent nhibernate objects available to conventions supports that).


here is a good way to implement this http://kinnrot.blogspot.com/2011/02/per-db-conventions-with.html

0

精彩评论

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