Hi,

I am trying to map two tables together through a composite key but
can't seem to find the correct syntax.

Database Tables

ORD_Customer
------------
ReqPointID
WhseCode
District
StockLocationCode
NonStockLocationCode

ORD_Address
-------------
WhseCode
District
LocationCode


The primary key on ORD_Customer is ReqPointID.
The primary key on ORD_Address is WhseCode/District/LocationCode.

StockLocationCode & NonStockLocationCode are foreign keys to
ORD_Address BUT they also need the WhseCode and District fields to get
a unique match.

CustomerMap

WithTable("ORD_Customer")
Id(Function(x) x.CustomerID, "ReqPointID")
Map(Function(x) x.WhseCode)
Map(Function(x) x.District)
References(Function(x) x.StockAddress, "StockLocation")
References(Function(x) x.NonStockAddress, "NonStockLocation")

AddressMap
WithTable("ORD_Address")

UseCompositeId() _
                .WithKeyProperty(Function(x) x.AddressID,
"LocationCode") _
                .WithKeyProperty(Function(x) x.WhseCode) _
                .WithKeyProperty(Function(x) x.District)

----------------------

So, my question is how should the References() calls be structured in
order to correctly map the WhseCode & District fields along with the
LocationCode fields?

Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to