Ok, I think I've nailed down my issue. It appears to be an issue with how I am configuring Fluent NHibernate, namely that in my PersistenceModel I am calling AddMappingsFromThisAssembly() instead of AddMappingsFromAssembly(assembly). Apparently the former doesn't do what I thought it did (That is, be a shortcut for the latter).
Switching to use the latter appears to have resolved my issue. Off to test some more. In the end, the symptoms I was seeing were of NHibernate not having any mapping files. So when I called Sesson.Query<T>().Where(predicate).SingleOrDefault(), NHibernate didn't figure out that it had no mapping file for type T and throw a more meaningful Exception, like the one I got when I called Session.Load() instead. I would still say there is a weird issue here in the NH.Linq code that allowed me to fall through to a "Index out of range" exception, but that is an exception handling issue, not an issue with NHibernate not working right... / Michael / On Jun 2, 3:40 pm, Beefy <[email protected]> wrote: > Here's another fun fact: > > When I change the first call to be a Load (simplifying here), I get > this back from NHibernate: > > Unable to locate persister: Domain.Model.User > > Does this shed any light on my underlying issue? > > / Michael / > > On Jun 2, 2:14 pm, Beefy <[email protected]> wrote: > > > > > > > > > So I fired up the SQL Profiler and actually looked at what the SQL > > server is seeing in these cases. > > > NHibernate is not executing any SQL, besides the begin transaction and > > end transaction stuff under Release mode. > > > / Michael / > > > On Jun 2, 1:07 pm, Beefy <[email protected]> wrote: > > > > I have not. I have just been browsing your repo online actually. I'm a > > > glutton for punishment like that. :-) > > > > I downloaded the source, built it in release mode and ran them all > > > without issue. Even when I changed the test assemblies to compile as > > > Release instead of Debug (as they were set to compile by default), > > > they still all pass. Which implies this is not an Nhibernate issue but > > > an issue with my implementation. > > > > That out of the way... does NHibernate only output certain log > > > information when the calling assembly is compiled in Debug mode? I am, > > > for instance, seeing a huge difference in the log between running my > > > solution in debug vs release, and wonder if this is why I am seeing > > > different things in NHProfiler in Release compared to Debug. > > > > / Michael / > > > > On Jun 2, 12:13 pm, Stephen Bohlen <[email protected]> wrote: > > > > > Those are all good points. Have you attempted to run exactly the test > > > > you > > > > mention in the trunk in release mode --? And if so, what are the > > > > results? > > > > > Steve Bohlen > > > > [email protected]http://blog.unhandled-exceptions.comhttp://twitter.com/sbohlen > > > > > On Thu, Jun 2, 2011 at 11:56 AM, Beefy <[email protected]> wrote: > > > > > I understand a unit test makes your lives easier. As I said though, it > > > > > really doesn't seem like I am doing anything here, though, as Ramon > > > > > points out, I MUST be since it isn't working. My unit test is simply > > > > > going to be something along the lines of > > > > > > Session.Query<T>().Where(x => x.someProperty == > > > > > "someValue").SingleOrDefault(); > > > > > > And that's pretty much it. My problem here is not that there is a bug > > > > > in NHibernate, but that I need help trying to track down what is > > > > > different in my implementation. A unit test such as this adds no > > > > > useful information to your testing suite, as I would suspect you > > > > > probably already HAVE a unit test that does exactly what I would do. > > > > > In fact, browsing the repo, I see you DO have exactly the test I would > > > > > do (granted, with LINQ commands instead of LINQ method chains), in > > > > > nhibernate/src/NHibernate.Test/Linq/WhereTests.cs. > > > > > > If that test runs in Release mode ok, then obviously there is not a > > > > > bug in NHibernate, but in my implementation. > > > > > > What I am asking for is help in figuring out where MY issue is. As the > > > > > NH Users group was unable to offer any assistance, I had hoped that > > > > > perhaps someone here would be able to help me out. If no one here is > > > > > willing to render such help, or I am asking in the wrong place (As I > > > > > may be), then I will gladly seek help elsewhere.
