Closed GoogleCodeExporter closed 9 years ago
Original comment by wmccaffe...@gmail.com
on 11 Mar 2009 at 1:35
Integrated mode worked for me in #Arch 1.0 beta, but stopped working in RC2. I
got the same
NullReferenceException as mentioned in the associated discussion. After trying
to find the
issue in ridiculous places, I finally realized it is the new locking construct
in the
Global.asax Init() method that causes the problem.
The first time Init gets called does not seem to be the right time to
initialize NHib, at
least for me. I created a temporary fix by adding another static private flag
"hasInitBeenCalledOnce" in addition to "wasNHibernateInitialized", and use it
like this:
base.Init();
if (!hasInitBeenCalledOnce) {
hasInitBeenCalledOnce = true;
return;
}
/* rest of init method. */
This way NHib is configured the second time Init gets called. Definitely a
hack, but it got
rid of the NullReferenceException for me. :)
Original comment by mar...@gmail.com
on 15 Mar 2009 at 10:39
martik,
Is Init guarenteed to be called twice? And isn't there a risk of NHibernate
not ever
being initialized since it's waiting until the 2nd call to init?
Original comment by wmccaffe...@gmail.com
on 2 Apr 2009 at 5:33
martik solution is work for me too.
thx
Original comment by ense...@gmail.com
on 12 Apr 2009 at 2:03
I think the following post may describe an issue with the double checked
locking
pattern implementation in Init():
http://www.bluebytesoftware.com/blog/PermaLink,guid,543d89ad-8d57-4a51-b7c9-
a821e3992bf6.aspx
If I read this correctly, the first test for wasNHIbernateInitialized should
use
Thread.VolatileRead to ensure that reordering of instructions doesn't allow the
initialization to happen twice.
Original comment by robscot...@gmail.com
on 12 Apr 2009 at 3:24
martik's solution doesn't work on XP when running in debug mode in VS 2008. I'm
currently trying out the solution that Kyle is suggesting at
http://groups.google.com/group/sharp-architecture/browse_thread/thread/913229c2c
54acd0d?hl=en
Original comment by wmccaffe...@gmail.com
on 2 May 2009 at 8:09
The fix requires the latest SharpArch.Data and requires a change to your
Global.asax.cs. See the Northwind project for example. Changes also
documented in
VersionHistory.txt.
Original comment by wmccaffe...@gmail.com
on 2 May 2009 at 3:48
thanx Martik, that worked perfectly for me. I could not for the life of me
figure it
out. thanx!
Original comment by neal.sor...@gmail.com
on 6 Jul 2009 at 3:56
Original issue reported on code.google.com by
wmccaffe...@gmail.com
on 11 Mar 2009 at 1:30