Search code examples
fluent-nhibernate

NHibernate.MappingException: Unknown entity class


I am trying to get test running that uses FluentNHibernate to map my entities.

I get unknown entity class error.

I have a Domain project that has my entities and the mappings in a seperate folder in that project.

My test project has the Nhibrenate configuration in the App.Config.

Any ideas please???

Malcolm

EDIT: I have this method that creats the ISessionFactory but I dont think this code is working and this is why it does not recoginze me mappings exist at all. The SessionFacoryCreator is the assembly with my AppConfig and Recipe is my assembly where the Domain objects are. Please HELLLLLLP!!!!

public static ISessionFactory Create()
        {
            Configuration cfg = new Configuration()
                .AddAssembly(typeof(SessionFactoryCreator).Assembly)
                .AddAssembly(typeof(Recipe).Assembly);

            return cfg.BuildSessionFactory();
        }

Solution

  • Have you read the wiki? Your example shows nothing of hooking Fluent NHibernate into the session factory building, that'd be why it isn't working. Start with the Getting Started guide.