Adam Fridental
unread,Feb 11, 2012, 10:31:53 AM2/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Fluent NHibernate
I've defined the primary key (of 'EntityWith2ColsPK') as following:
CompositeId()
.KeyProperty(x => x.Id)
.KeyProperty(x => x.Type);
For the other entity, I've tried the following:
References(x => x.EntityWith2ColsPK);
And failed with:
Foreign key (Fk_MyEntity_EntityWith2ColsPK:MyEntities
[Fk_EntityWith2ColsPK])) must have same number of columns as the
referenced primary key (EntityWith2ColsPKs [Id, Type])
How can I reference EntityWith2ColsPK from another entity?
I've tried this:
HasMany<EntityWith2ColsPK>(x =>
x.EntityWith2ColsPK).KeyColumns.Add("Id", "Type").Cascade.All();
Which failed with:
Custom type does not implement UserCollectionType: Category
But anyway I don't want a 1 to many relation, I want a 1 to 1
relation. Still, I can't make either of them work.
Also, I've tried:
HasOne<EntityWith2ColsPK>(x => x.EntityWith2ColsPK).PropertyRef(x
=> x.Id).PropertyRef(x => x.Type);
Which fails with:
NHibernate.MappingException : property not found: Language on
entity AFR.Domain.Entities.Category
What can I do for this to really work?