Fluent composite foreign key mapping

Posted by Fionn on Stack Overflow See other posts from Stack Overflow or by Fionn
Published on 2010-05-23T17:28:23Z Indexed on 2010/05/23 17:30 UTC
Read the original article Hit count: 607

Hi,

I wonder if this is possible to map the following with fluent nhibernate:

A document table and a document_revision table will be the target tables.

The document_revision table should have a composite unique key consisting of the document_id and the revision number (where the document_id is also the foreign key to the document table).

class Document
{
    Guid Id;
    //other members omitted
}

class DocumentRevision
{
    Guid document_id; //Part one of the primary key and also foreign key to Document.Id
    int revision; //Part two of the primary key
    //other members omitted
}

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about mapping