Component convention and column prefix mayhem #161

Open
jagregory opened this Issue Aug 18, 2012 · 8 comments

Comments

Projects
None yet
5 participants
Collaborator

jagregory commented Aug 18, 2012

See: http://stackoverflow.com/questions/11051515/fluentnhibernate-doubles-columnname-when-using-icomponentconvention-maps-v1-3-0

This works in v.717 (IComponentConvention) :

public void Apply(IComponentInstance instance)
{
  if (instance.Type == typeof(EmailAddress))
  {
    instance.Properties.First(property => property.Name == "FullAddress")).Column(instance.Name);
  }
}

Using the above convention I can map the name of my database column to the name of the component property. But in v.727 the hbm suddenly looks like this:

<component name="DefaultMailAddressForAlerts" class="EmailAddress"> 
  <property name="FullAddress" type="System.String"> 
    <column name="DefaultMailAddressForAlertsDefaultMailAddressForAlerts"/>          
  </property> 
</component>

Making the column name in the database the name of the component property x 2. Is there a new way of creating component conventions in v727 of fluent nhibernate?

Collaborator

jagregory commented Aug 18, 2012

yngvebn commented Aug 18, 2012

Thanks! A workaround is to replace .Column(instance.Name) with .Column(string.Empty)
Seema like something has changed with how the ConventionBuilders do their job..

Collaborator

chester89 commented Feb 19, 2013

Nice workaround :)

Collaborator

chester89 commented Feb 19, 2013

May be I'm doing this wrong, but with this config https://gist.github.com/chester89/4990411 my convention isn't even called :(

Collaborator

chester89 commented Feb 19, 2013

yep, and that's exactly what happens when I try to do this via public API.

Collaborator

chester89 commented Feb 19, 2013

I need your help here, guys. It seems I'm applying conventions in a wrong way - since it's not being honored

The same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment