I've not followed the discussion completely, so sorry if I'm off the mark
here.

Currently, GetPrimaryKeyName is:

public Func<PropertyInfo, string> GetPrimaryKeyName = prop => prop.Name;

Chris suggested that it should be:

public Func<Type, string> GetPrimaryKeyName = type => "Id";

I'm uncomfortable with this change, because I think if somebody defines this
class:

public class Customer
{
  public int PersonID { get; set; }
}

And then attempts to map it, they will get CustomerID instead of PersonID,
which is not intuitive. You need to remember here that there are people
using nhibernate against legacy databases which may not follow expected
conventions. I think it is unreasonable to expect this person to fiddle
around with the conventions to get this simple situation to work as
expected.

Couldn't you achieve the requested behaviour but without changing the
signature of GetPrimaryKeyName by doing this:
Conventions.GetPrimaryKeyName = prop => prop.DeclaringType.Name + "Id";

Again, sorry if I've misunderstood.

Paul Batum

On Fri, Dec 12, 2008 at 1:52 AM, Andrew Stewart <
andrew.stew...@i-nnovate.net> wrote:

> Hi
> I've remembered the reason why It's off Property. Lets say you have the
> following, basically manual fluent nhibernate, assume's that whatever you
> call the property to match the column name unless you say other wise, so:
>
> product.ProductId ----> column propductId
> product.BigPrimaryKeyId ---> column BigPrimaryKeyId
>
> As such because Automapping sits on top of fluent nhibernate I've tried not
> to impose anything from AutoMap into the core except where
> I've absolutely needed to. So thats why this comes from the property not
> from the type, sorry as you've mentioned from an automapping perspective
> type does make alot more sense.
>
> Sorry, I'd rather not make that change until someone from the manual side
> says it's ok, would anyone like to shed some light on this.
>
> Cheers
>
> Andy
>
>
>
>
> On Thu, Dec 11, 2008 at 11:41 AM, Andrew Stewart <
> andrew.stew...@i-nnovate.net> wrote:
>
>> Hi
>> Sorry mate, I've been off ill, so will make the change as soon as I've
>> caught up on everything.
>>
>> Cheers
>>
>> Andy
>>
>>
>> On Wed, Dec 10, 2008 at 4:08 PM, Chris Marisic 
>> <chrismari...@hotmail.com>wrote:
>>
>>>
>>> Did you decide what the resolution to this is?
>>>
>>>
>>
>>
>> --
>> =================
>> I-nnovate Software - Bespoke Software Development, uk wirral.
>> http://www.i-nnovate.net
>>
>
>
>
> --
> =================
> I-nnovate Software - Bespoke Software Development, uk wirral.
> http://www.i-nnovate.net
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to