I think it's better to send to Fluent NHibernate group:
[email protected]
http://groups.google.com/group/fluent-nhibernate

You are unlikely to get help here because older NH users (older, as in in
early use of NH) do not usually get to try FNH, mainly because its API
naming terminology is in many places different than what the XML mapping
calls/names things.
This can be really confusing if you have been working with XML mapping for
quite long.

However, I do not understand why you believe you need to do extra effort in
your mapping to tell OrderLine what is the PK of Product. It should just
work if you use CompositeKey.KeyReference( x => x.Product). Are you using an
existing database oir generating the DB via SchemaExport or ScheUpdate (NH)?
Maybe you mean you need to specify the exact foreign key fields?

BTW, in my tried to get CompositeKey with KeyReference, I have found that
it's usually better to just add an extra "Id" column and map the other parts
as normal properties/references, (although I don't remember the exact
reasons right now).


Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: [email protected]
Weblog: http://weblogs.asp.net/meligy


On Mon, Feb 1, 2010 at 12:38 PM, pdejonghe <[email protected]>wrote:

> Hi,
>
> I can't seem to find a suitable best practice to configure the
> following (fictious) situation::
>
> - suppose table [Product] which has a PK composed of two fields:
> "Category" and "SupplierID"
> - suppose table [OrderLine] which has a PK composed of three fields:
> the two fields from [Product] (being "Category" and "SupplierID") and
> an additional "OrderLineNumber".
>
> In the mapping for [Product], I put:
>
> CompositeId().KeyProperty(x => x.Category, "Category").KeyProperty(x
> => x.SupplierID, "SupplierID");
>
> In the mapping for [OrderLine], what do I do? I tried something like:
>
> CompositeId().KeyProperty(x => x.OrderLineNumber,
> "OrderLineNumber").KeyReference(x => x.Product .......
>
> but then I got stuck, as there is no way (that I know of) to tell the
> KeyReference() method that it should consider "Category" and
> "SupplierID" when pinpointing the Product.
>
> Thx for any answer,
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to