We are in the process of writing code to generate check constraints
with all valid values from our enumeration mappings. Some of our
enumerations are inside composite-elements through mapped set
collections (see below):
<set name="Addresses" table="[Addresses$]" access="field.camelcase-
underscore">
<key column="Person" />
<composite-element class="Address">
<property name="StreetAddress1" column="[Street
Address 1]" />
<property name="City" />
<property name="State"
type="DataAccess.Mappings.UserTypes.EnumerationDisplayNameType`1
[[Core.Domain.Model.Enumerations.State, Core]], Import" />
</composite-element>
</set>
We can successfully get all the valid values for a particular
enumeration using reflection when the enumerations are simply mapped
as properties or inside components. We do this by getting
NHibernate.Mapping.Table and iterate over the columns looking for our
enumeration type. Our problem is with the collection types. The
ColumnsIterator count is always zero for the collection types.
Has anyone been successful in getting column information from mapped
sets (that happen to be value objects, if that matters at all) in
code?
Not sure it's clear what we are trying to do. Let me know if there's
more information needed to better understand the issue.
Any help here is much appreciated.
Thanks!