Afshar
Afshar

Reputation: 11483

How can I disable NHibernate lazy loading for a total application?

In a special case we do not want to change mapping files and adding lazy="false" to each of them because of upgrading NHibernate. Is it possible to disable lazy loading in a total application by just adding something to app.config or web.config?

Upvotes: 4

Views: 2315

Answers (1)

JoshBerke
JoshBerke

Reputation: 67068

From what I can tell you will have to change the mapping files. I might be wrong but I couldn't find any global setting.

If you didn't want to change the class definition you could define it in the root element of each mapping file you have:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-lazy="false">

Upvotes: 2

Related Questions