NHibernate: These classes referenced by "extends" were not found

I have a simple example; a concrete class that inherits an abstract generic class that implements the interface.

i.e. StringProperty -> AbstractProperty <T> -> IProperty

I get the following error ...

NHibernate.MappingException: These classes referenced by 'extends' were not found:
NhibernateTest.AbstractGenericProperty`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], PromoNhibernateTest
   at NHibernate.Cfg.MappingsQueue.CheckNoUnavailableEntries()
   at NHibernate.Cfg.Configuration.SecondPassCompile()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()

I am using NHibernate attributes that produce the following mapping ...

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="NhibernateTest.AbstractGenericProperty`1, PromoNhibernateTest" lazy="false" table="Properties">
    <id>
      <generator class="identity" />
    </id>
    <discriminator column="Name" type="String" />
  </class>
  <subclass name="NhibernateTest.StringProperty, PromoNhibernateTest" lazy="false" extends="NhibernateTest.AbstractGenericProperty`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], PromoNhibernateTest" discriminator-value="string" />
</hibernate-mapping>

Please report what is wrong with the display.

Thanks,

Ted.

+3
source share
1 answer

The problem is that it is not possible to display AbstractProperty.

You cannot display public generic types, even if you also create subclass mappings that define the generic type.

, NHibernate , , , AbstractProperty, .

0

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


All Articles