views:

55

answers:

2

I'm trying to follow the "Your first project" tutorial at http://wiki.fluentnhibernate.org/Getting_started and have hit a roadblock. When I try to run the console application, I'm getting this error: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. I have created a SQLite database "firstProject.db" and referenced the full path to the file in the call to:

return Fluently.Configure()
            .Database(SQLiteConfiguration.Standard
                .UsingFile(DbFile))
            .Mappings(m =>
                m.FluentMappings.AddFromAssemblyOf<Program>())
            .ExposeConfiguration(BuildSchema)
            .BuildSessionFactory();

so I don't know what I'm doing wrong. What/where is this "PotentialReasons" collection? Thank you for the help.

Andy

+1  A: 

PotentialReasons is a property of the FluentConfigurationException class.

You need to debug and inspect the exception to see what is in PotentialReasons.

In my experience you'll find the more informative stuff in the InnerException which is also a property of the exception and is the underlying exception that is being wrapped.

vakman
A: 

I had to add a try/catch around the block of code above, and inspect the InnerException of the InnerException of the FluentConfigurationException object to get some more meaningful exceptions. After Googling those exceptions, I found that I needed to add references to System.Data.SQLite as well as NHibernate.ByteCode.Castle.dll. In the tutorial, it DOES say you need a reference to System.Data.SQLite, but it doesn't mention NHibernate.ByteCode.Castle.dll anywhere. Very frustrating when this is supposed to be the intro to Fluent NHibernate.

Thanks, Andy

Andy

related questions