问题描述
应该使用哪些配置选项来构建不会累积更新的会话,并且始终保持只读?
似乎将第一个或第二个对于只读版本的高级缓存可能是答案,如何使用流畅配置实现?
http://stackoverflow.com/questions/768191/how-to-create-a-readonly-session-in-nhiberate\">如何在nHiberate中创建只读会话?
或者你可以用你自己的没有做任何事情的实现替换默认的Save / Update / Delete事件监听器。
要这样做,在你的NHibernate配置你需要做类似的事情: Fluently.Configure()
//你的配置在这里
.ExposeConfiguration(
x => x.EventListeners.SaveOrUpdateEventListeners =
new ISaveOrUpdateEventListener [] {new NoOpEventListener()};
//其他类型的
$ b
What configuration options should be used to construct a session that will not accumulate updates, and will always remain read only?
It would seem that replacing the first or second level cache for a read only version might be the answer, how is that achieved using fluent configuration?
See how to create a readonly session in nHiberate?
Alternatively you can replace the default Save/Update/Delete event listeners with your own implementations that do nothing
To do so, in your NHibernate configuration you will need to do something like:
Fluently.Configure()
// your config goes here
.ExposeConfiguration(
x => x.EventListeners.SaveOrUpdateEventListeners =
new ISaveOrUpdateEventListener[ ]{new NoOpEventListener() } ;
// etc for other types
这篇关于如何使用Fluent NHibernate创建一个不累积更新的NHibernate只读会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!