Change name of ID property for automapping
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
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Paul Batum on 21 May, 2010 11:04 PM
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.
Support Staff 3 Posted by James Gregory on 21 May, 2010 11:19 PM
It's already updated ;)
4 Posted by Kevin Thiart on 24 May, 2010 10:10 AM
Awesome!
Thanks for the help. I've been through the wiki so many times, can't believe I missed that section.
Regards
Paul Batum closed this discussion on 30 May, 2010 04:43 AM.