Did some stepping and found this:
PropertyMap.Write()
public void Write(XmlElement classElement, IMappingVisitor visitor)
{
visitor.Conventions.AlterMap(this);
XmlElement element = classElement.AddElement("property")
.WithAtt("name", _property.Name)
.WithProperties(_extendedProperties);
element.AddElement("column").WithProperties(_columnProperties);
foreach (var action in _alterations)
{
action(element);
}
}
The call to visitor.Conventions.AlterMap seems to modify the
_alterations without regard to the pre-existence of an alteration of
the same "type".
Prior to calling that line _alterations contained my one alteration
setting the IUserType; after calling that line it has 3 alterations:
[0]: {Method = {Void <CustomTypeIs>b__6(System.Xml.XmlElement)}}
<--- The only one that should be here.
[1]: {Method = {Void <CustomTypeIs>b__6(System.Xml.XmlElement)}}
[2]: {Method = {Void <CustomSqlTypeIs>b__c(System.Xml.XmlElement)}}
I'll take a look at modifying the default Enum convention such that it
will look for existing alterations and, if one exists for either
CustomeTypeIs or CustomSqlTypeIs then it will ignore the property.
Does that sound like expected/reasonable behavior?
On Feb 17, 2009, at 6:38 PM, Brendan Erwin wrote:
> I didn't see anything in the issue list about this so maybe I'm the
> first to notice:
>
> Given this mapping:
>
> WithTable("Insurance");
>
> ...
>
> Component(x => x.InsuranceCardData, m =>
> {
> ...
> m.Map(x =>
> x.PatientRelationshipToInsured,
>
> "RelationshipFlag")
> .CustomTypeIs
> (typeof(PatientRelationshipToInsuredUserType));
> });
>
>
> I get this HBM:
>
> <?xml version="1.0" encoding="utf-8"?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
> lazy="true" assembly="Clearwave.Models"
> namespace="Clearwave.Models.Encounters">
> <class name="Insurance" table="Insurance" xmlns="urn:nhibernate-mapping-2.2
> ">
> ...
> <component name="InsuranceCardData" insert="true" update="true">
> ...
> <property name="PatientRelationshipToInsured"
> type
> =
> "FluentNHibernate
> .Mapping
> .GenericEnumMapper`1[[Models.PatientRelationshipsToInsured,Models,
> Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]],
> FluentNHibernate, Version=0.1.0.0, Culture=neutral,
> PublicKeyToken=8aa435e3cb308880">
> ...
> </component>
> ...
> </class>
> </hibernate-mapping>
>
>
> Shouldn't the HBM be referencing my custom type instead of the
> GenericEnumMapper?
>
>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---