I have a User entity that has a IList property. The mapping for this looks like this:
HasMany(x => x.Forms)
.Cascade.None()
.AsBag().KeyColumn("Supervisor")
.Key(key => key.Not.Update())
.PropertyRef("Email");
Now I have a new feature request in that essentially adds another
KeyColumn that should ALSO populate into this property. Essentially,
each form can have a "Supervisor" and an "Alternate", and I need this
property to populate any Forms where the User.Email
is equal to either
one (Forms BELONG to a User IF the User.Email == Form.Supervisor OR User.Email == Form.Alternate
).
Is there a way to do this? Simply adding another KeyColumn
specification simply overrides the previous one, and adding keys via
the Keys()
method seems to not allow for multiple key columns like I
want... I m looking for a way to essentially tell it that this
relationship should be found with a WHERE Superviser = Email OR Alternate = Email
, but it doesn t seem to support that OR
clause...
我的另一种选择基本上是重复这一绘图,但对于在另一个财产中“兄弟”的描述,然后用我消费的法典将收集材料合在一起,但我希望看到,NHibernate是否有足够的智慧这样做。
Any suggestions?