Hello,

I've managed to build up a series of Collection/CollectionItem
containers, whose Items themselves host another domain model,
something like CollectionItem<Payload> type thing.

For the most part I've been successful in mapping these to the
database through Fluent NHibernate, but I am running into an odd
corner case in the ForeignKeyConvention.

I do the sort of prototypical:

        protected override string GetKeyName(Member property, Type type)
        {
            if (property != null)
                return property.Name + @"Id";

            return type.Name + @"Id";
        }

if you will.

However, this isn't quite right in all cases, and I do indeed want to
depend on Member property being there as this contains the property
name of concern.

The type name is incorrect in virtually all cases.

The corner case is that property is turning up null in the
Collection/CollectionItem use case. Note, it is heavy in the generics,
is really unavoidable.

Is there a better way to utilize conventions to do this? And/or
otherwise workaround the convention, such as to specify the KeyName at
the time of mapping?

It seems I've tried this too, but the convention wants to operate
instead. That is unless there's something else I can override in the
convention to flag this being the case.

Thank you...

Best regards,

Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to