Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component convention and column prefix mayhem #161

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

Component convention and column prefix mayhem #161

jagregory opened this issue Aug 18, 2012 · 8 comments
Labels

Comments

@jagregory
Copy link
Collaborator

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?

@jagregory
Copy link
Collaborator Author

cc @yngvebn

@yngvebn
Copy link

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

@chester89
Copy link
Collaborator

Nice workaround :)

@chester89
Copy link
Collaborator

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

@chester89
Copy link
Collaborator

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

@chester89
Copy link
Collaborator

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

@TheCloudlessSky
Copy link

👍

@AqlaSolutions
Copy link

The same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants