The dreaded “NHibernate.MappingException: Unknown entity class” exception thrown by NHibernate in your .NET web application indicates that the class you are trying to map in your .hbm.xml file cannot be located for some reason.
The first thing to check is to right-click on each of your .hbm.xml files and make sure the Build Action property is set to “Embeded Resource.” This tells .NET to compile the mapping file into the Assembly .dll
If you confirmed that the Build Action is correct then for some reason NHibernate cannot locate your class within the project. Double check that the path to your class is correct. If you’re building a .NET 2.0 website and your model code is inside the App_Code directory, make sure that you have specified the Assembly name of “App_Code”. The .NET framework automatically creates this assembly name for your web project.
Share This