I'm having trouble figuring out how to map an interface while using a composite key.
What I'm trying to do is this:
interface Ifoo
{
int someInt {get;}
int id {get;}
}
class bar1: Ifoo
{
int someInt {get; protected internal set;}
int id {get; protected internal set;}
}
class bar2: Ifoo
{
int someInt {get; protected internal set;}
int id {get; protected internal set;}
}
class someOtherClass
{
Ifoo myFoo {get; protected internal set;}
int id {get; protected internal set;}
}
public class someOtherClassMap: ClassMap<someOtherClass>
{
CompositeId()
.KeyReference(x => x.myFoo, "fooID")
.KeyProperty(x => x.id, "id");
References(x => x.myFoo)
.Class(typeof (foo1))
.Class(typeof (foo2))
.Column("fooID")
.Not.Insert()
.Not.Update();
}
The References works without issue, but I can't get the KeyReference to work, and there doesn't seem to be any ".Class" I can use like I can with References.
I read:
Fluent NHibernate, working with interfaces
Programming to interfaces while mapping with Fluent NHibernate
and that let me fix the References issue, but I haven't found a work around for the KeyReference. Is there something obvious I'm missing, cause I've been googling around for awhile, and so far haven't been able to find anything.