C# – Fluent NHibernate MappingException : could not instantiate id generator

cfluent-nhibernatenhibernate

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.

Best Answer

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

Related Topic