Fluent NHibernate: Debugging a FluentConfigurationException

I like to use Fluent NHibernate with AutoMappings, but from time to time I get this error at runtime when trying to create a free configuration: "An invalid or incomplete configuration was used when creating the SessionFactory. For more information, see the PotentialReasons and InnerException collections.

Now this may mean all kinds of things, but the details of the exception are not very useful at all. Sometimes a class that NHibernate cannot handle will be specified in an InnerException, in other cases, I get such mystical messages:

{"(XmlDocument) (3,6): XML validation error: class element in namespace 'urn: nhibernate-mapping-2.2' has an invalid child element 'property' in namespace 'urn: nhibernate-mapping-2.2' List of expected elements: "meta, subquery, cache, synchronization, comment, tuplizer, id, compound identifier" in the namespace "urn: nhibernate-mapping-2.2". " }

It really doesn't help me track the error. Is there a way to get a detailed log of what NHibernate is trying to do (i.e. which class / method it currently automatically displays) so that I can at least identify part of my code causing the problem?

edit:

Known causes of this error:

  • database connection (should be seen in the details of InnerException)
  • ( InnerException)
  • ID ( , )
+3
2

, - nhibernate. , .

, , .

- nhibernate

+2

NHibernate! NHibernate. , .

, , "Id" , .

, , , .

+3

Source: https://habr.com/ru/post/1725752/


All Articles