NHibernate.MappingException: Unknown entity class – Education Career Blog

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();
        }

,

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.

,

How do you add your Entities to the Hibernate framework? Are you using AnnotationConfiguration or just Configuration? If you are using annotations you must add your annotated entity to the framwork. Otherwise, if you are using xml hibernate mapping, the syntax could be worng (iirc)

Leave a Comment