Maybe the optimizations could've come a little sooner?
Okay, I'm getting curious about
stuff, so I keep the SQL profiler open, and I just saw a single page issue
91(!) SQL statements. Granted, this is a complex page, but I think that I can
do it manually with maybe 4 SQL statements (and ~5,000 Line of code to sort it
out later).
There are some parts of the code
that I really don't know what to do. On the one hand, lazy loading some
of the information make sense most of the time, but that may bring me to the
horrendous Select N+1 problem.
Right now I'm deferring the
decision, I added some lazy attributes, and that reduced the problem somewhat
to 72(?!) statements. Still way too high, but this require some thought
before acting. I'll let it lie in peace now, while I consider what to do. I also
made a huge mistake by not running the test after I changed each
relationship to lazy. I got so many errors when I finally did run them that it
took me way too long to fix them.
One other thing I discovered,
NHibernate assumes that accessing the properties is always safe, and it breaks
it pretty badly if you start to mess with uninitialized collections during the initialization
process. I reverted back to the old behavior (yes, I'm inconsistent, I know.)
Comments
Comment preview