-
Notifications
You must be signed in to change notification settings - Fork 934
Update the <any /> mapping documentation #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This documentation is obsolete since NH 2.0.
<programlisting><![CDATA[<any name="AnyEntity" id-type="Int64" meta-type="Eg.Custom.Class2TablenameType"> | ||
<column name="table_name"/> | ||
<programlisting><![CDATA[<any name="AnyEntity" id-type="long" meta-type="class"> | ||
<column name="type"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not have to be a table name.
<literal>id-type</literal>. If the meta-type returns instances of <literal>System.Type</literal>, | ||
nothing else is required. On the other hand, if it is a basic type like <literal>String</literal> or | ||
<literal>Char</literal>, you must specify the mapping from values to classes. | ||
<literal>id-type</literal>. If the meta-type is <literal>class</literal>, nothing else is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support of TypeType
is gone since NH 2.0, as reported in NH-1403. This has been fixed by "hijacking" the TypeType
alias class
for instead yielding ClassMetaType
when class
is used in the meta-type
attribute of an any
mapping (or ...-to-any
).
(This can be confusing for those who know class
is TypeType
alias, because TypeType
persists the assembly qualified type name whereas ClassMetaType
persists the full-name instead (no assembly in it).)
<literal>id-type</literal>. If the meta-type is <literal>class</literal>, nothing else is required. | ||
The class full name will be persisted in the database as the type of the associated entity. | ||
On the other hand, if it is a basic type like <literal>string</literal> or | ||
<literal>char</literal>, you must specify the mapping from values to classes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not actually true: string
and any string like types may work without meta-values. In such case they work somewhat similarly to class
, but without a dedicated NHibernate MetaType
. That causes issues, like those not fixed in #1803. So I have decide to keep that sentence.
If we fix this, this part would have to be updated.
This documentation is obsolete since NH 2.0.