Thursday, November 17, 2011

NHibernate metadata reader closed problem

Encountered that exception, had no idea what it is. Googled and some people suggest it is a bad table, some suggested it is the session out of scope. None fits my situation. So I go ahead setup the nhibernate/active record/fluent source, did some debugging. What happened is someone is using StructureMap's ObjectFactory.Get() method inside a domain model's constructor, and while nhibernate is constructing that object, the constructor is doing more nhibernate calls via IOC. That is just bad, and now it is solved :-)

1 comment:

Eran Smith said...

I like this blog is fantastic, is really good written.
.net Obfuscator