I have the following tables:
table A:
FOO (PK) | CLIENT (PK)
table B:
BAR (PK) | CLIENT (PK/FK) | FOO (FK)
PK -> primary key
FK -> foreign key
There's a one-to-many relation between A and B. I can't simply do this:
class AMap
{
public AMap()
{
CompositeId().KeyReference(a => a.FOO)
.KeyReference(a => a.CLIENT);
HasMany(a => a.B);
}
}
class BMap
{
public BMap()
{
CompositeId().KeyReference(a => a.BAR)
.KeyReference(a => a.CLIENT);
References(a => a.A);
}
}
It will fail with the following exception:
Foreign key (FKE7804EB3DA7EBD4B:B [FOO])) must have same number of columns as the referenced primary key (A [FOO, CLIENT])
Is it possible to map this correctly with fluent nhibernate?