Protected and / or internal properties of components in NHibernate

The docs for NHibernate clearly state that properties (and I assume the extension components) can be mapped to any access modifier. However, this is not the behavior that I see, and I wonder if anyone can tell me if this is my mistake or if it is the result of poorly documented behavior in NHibernate.

Component class (some unimportant methods are omitted):

public class IPAddressComponent
{
    public virtual byte Octet1 { get; set; }
    public virtual byte Octet2 { get; set; }
    public virtual byte Octet3 { get; set; }
    public virtual byte Octet4 { get; set; }
}

Contains a class:

public class Host
{
    public virtual Guid ID { get; set; }
    // snip a bunch of other auto-properties
    // ...
    protected internal virtual IPAddressComponent IPComponent { get; set; }
    public virtual int Port { get; set; }
}

Display:

<class name="Host" table="Hosts">
  <id name="ID" column="HostID">
    <generator class="guid"/>
  </id>
  <component name="IPComponent">
    <property name="Octet1" column="Host1"/>
    <property name="Octet2" column="Host2"/>
    <property name="Octet3" column="Host3"/>
    <property name="Octet4" column="Host4"/>
  </component>
  <property name="Port"/>
</class>

... , /​​ , HostComponent null . , protected internal public, , , . , NHibernate , , , , .

NHibernate , - ?

P.S. - , , IPAddress Host / IPAddressComponent. 4 . , ; , .

+3

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


All Articles