$ cat "

Fluent-NHibernate - Unknown Entity Class Exception

"

If you are using Fluent NHibernate and you get the exception:

NHibernate.MappingException: Unknown entity class: Foo.Bar.Baz

Make sure your mapping file (BazMap in this example) is public.

If you still get the exception, make sure you are loading you class maps correctly. It should look something like this:

Configuration configuration = new Configuration().Configure();

var persistenceModel = new PersistenceModel();
persistenceModel.addMappingsFromAssembly(typeof(Baz).Assembly);
persistenceModel.Configure(configuration);

var sessionFactory = configuration.BuildSessionFactory();

PersistenceModel is located in the FluentNHibernate namespace.

Written by Erik Öjebo 2008-11-18 11:19

    Comments