Change name of ID property for automapping

Kevin Thiart's Avatar

Kevin Thiart

20 May, 2010 01:45 PM via web

So far I've only found examples of changing column names in conventions. But we have coding standards in place that prevent me from naming my entity Id properties "Id".

Is there any way to change the Id property of all classes to something other than "Id". And also, is it possible to do this on a class-to-class basis using a convention of some sort? Some of our entities have "Code"s instead of "Id"s.

Thanks!

Kevin

  1. Support Staff 2 Posted by Paul Batum on 21 May, 2010 11:04 PM

    Paul Batum's Avatar

    I think this is what you want:
    http://wiki.fluentnhibernate.org/Auto_mapping#Identities

    <http://wiki.fluentnhibernate.org/Auto_mapping#Identities>One further note -
    in the very latest builds, the way you configure the automapper has changed,
    so you may get a obsolete warning using the approach described on the wiki.
    The new approach is to inherit from DefaultAutomappingConfiguration,
    override the appropriate methods, and pass your derived version to the
    automapper. I think James should have some documentation on this up on the
    wiki before long.

  2. Support Staff 3 Posted by James Gregory on 21 May, 2010 11:19 PM

    James Gregory's Avatar

    It's already updated ;)

  3. 4 Posted by Kevin Thiart on 24 May, 2010 10:10 AM

    Kevin Thiart's Avatar

    Awesome!

    Thanks for the help. I've been through the wiki so many times, can't believe I missed that section.

    Regards

  4. Paul Batum closed this discussion on 30 May, 2010 04:43 AM.

Comments are currently closed for this discussion. You can start a new one.