NHibernate.MappingException: Unknown entity class

If you get MappingException error, there are two things you should check out:

  • Make sure the name of the *.hbm.xml is spelled correctly — not *.hmb.xml nor *.mbh.xml
  • Make sure the Build Action property is set to “Embeded Resource.”

I learned this the hard way. First, I wrongly spelled hbm.xml and I had its Buld Action property set to “Content”. The above 2 points fixed the problem.

Credit: VerySimple, Inc