Skip to content
This repository

Component convention and column prefix mayhem #161

Open
jagregory opened this Issue · 7 comments

4 participants

James Gregory Yngve Bakken Nilsen Gleb Chermennov Adrian Phinney
James Gregory
Owner

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?

James Gregory
Owner
Yngve Bakken Nilsen

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..

Gleb Chermennov
Collaborator

Nice workaround :)

Gleb Chermennov
Collaborator

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

Gleb Chermennov
Collaborator

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

Gleb Chermennov
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.