If you are working with NHibernate and trying to use the discriminator feature, you may found an error saying that, according to the XML Schema validation, you can’t put a “discriminator” element under a “class” element. Which is very odd since that’s what the official documentation says:
The error you may be getting should read something like this:
MappingException: XML validation error: The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'discriminator' in namespace 'urn:nhibernate-mapping-2.2'.
El elemento 'class' en espacio de nombres 'urn:nhibernate-mapping-2.2' tiene un elemento secundario 'discriminator' en espacio de nombres 'urn:nhibernate-mapping-2.2' no válido.)
The solutions is actually quite simple: the “discriminator” element should be placed right after the “id” element, before the rest of the properties. That’s it.
Apparently there’s a restriction about it’s placement that is not specified in the documentation.
I hope this helps anyone facing this issue with no clue to what it could be.