views:

956

answers:

1

I'm pottering around with Fluent NHibernate to try and get a simple app up and running. I'm running through this Fluent NHibernate Tutorial.

Everything seems to be going fine and I've created the required classes etc. and it all builds, but when I run the test, I get an exception. Someone in the comments section of the tutorial has the same problem, but I can't find any good information on what's causing it. Any help appreciated. It's probably something trivial.

Exception details:

FluentNHTest.Tests.Mappings.CustomerMappingTests.ValidateMappings: FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

----> FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

----> NHibernate.MappingException : could not instantiate id generator ----> System.FormatException : Input string was not in a correct format.

+2  A: 

I've solved this by changing this line:

In CustomerMapping:

Id(c => c.Id).GeneratedBy.HiLo("customer");

To:

Id(c => c.Id).GeneratedBy.HiLo("1000");

Hope it helps you.

Ariel

ArielBH
I ended up nuking my project and starting again, closely mirroring the included sample project included in the FluentNHibernate source. However, I just added the "GeneratedBy" line back to one of the mapping classes to see if it still happened and, yes, it recurred. Changing the line to your suggestion fixed it. Thank you.
Mark Simpson