Sorry, your whole conversation went on while I was asleep apparently. I'll review this asap.
On Wed, Feb 18, 2009 at 3:58 AM, Brendan Erwin <[email protected]>wrote: > Heh, talking to myself here. :) > Anyway, I put this issue in the tracker and attached the patch there too. > > http://code.google.com/p/fluent-nhibernate/issues/detail?id=117 > > > On Feb 17, 2009, at 10:44 PM, Brendan Erwin wrote: > > Here is a patch that adds IProperty.HasAlterationFrom and modifies the Enum > Convention to not stomp existing alterations. > <Add IProperty.HasAlterationFrom and modify Enum Convention to not stomp > existing alterations.zip> > > It includes a test for the HasAlterationFrom method but I didn't see how > the conventions are being tested. > > > On Feb 17, 2009, at 9:59 PM, Brendan Erwin wrote: > > 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 -~----------~----~----~----~------~----~------~--~---
