Composite ID with property that also contains composite ID

Richard Gavel's Avatar

Richard Gavel

18 May, 2010 04:06 PM via web

Assume the following class structure:

class Company
public string ClientId public string Code

class Employee
public Company Company public string SSN

The PK for Company is Client ID and Code. The PK for Employee is Company and SSN (therefore Company.Client ID, Company.Code, SSN). However, the fluent interface doesn't support this concept. CompositeIdentityPart assumes the PK of the linked object will be one column. The only change I can see that is consistent is to support multiple invocations to KeyReference whereby if you supply the same expression, it would add a column mapping to the existing KeyManyToOneMapping instead of assuming a new one. Do you agree? I ask because there seem to be a couple different styles for configuring multiple items in Fluent NHibernate. Some use multiple invocations of the same method, some have a method for purposes of a single item plus a collection for multiple items.

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      Five times two is what?