Bi-directional ReferencesAny() ?

33 views
Skip to first unread message

MoD

unread,
Feb 6, 2012, 1:23:58 PM2/6/12
to Fluent NHibernate
Hi,
Is there a way to do a bi-directional any mapping?

ReferencesAny(c => c.SharedEntity)
.EntityTypeColumn("ParentType")
.EntityIdentifierColumn("ParentId")
.IdentityType<int>()
.MetaType<string>();

SharedEntity is a class (ie Contact, Company)
Normally, if i used References(), i should add HasMany(x=>
x.SharedEntity) to Contact/Company classes.
What shall i add to Contact/Company to get SharedEntities?

MoD

unread,
Feb 6, 2012, 2:09:29 PM2/6/12
to Fluent NHibernate
Is it ok to use:

HasMany(x =>
x.SharingRecords).Inverse().Cascade.AllDeleteOrphan().KeyColumn("ParentId").Where("ParentType='Company'");
Reply all
Reply to author
Forward
0 new messages