FluentNHibernate: how to Join to table without using primary key
In the follow开发者_JAVA技巧ing FluentNHibernate mapping:
public LawbaseAssetMap()
{
Table("PRASSET");
Id(x => x.Id).Column("PRA_RECNUM");
Join("PRSTOCK", m =>
{
m.Fetch.Join();
m.Optional();
m.KeyColumn("PRS_ASSRN");
m.Map(t => t.Certificated).Column("PRS_CERT").CustomType("YesNo");
});
}
I am performing an outer join from the table PRASSET
to the table PRSTOCK
. The join is between PRSTOCK.PRS_ASSRN
and PRASSET.PRA_RECNUM
(the primary key of PRASSET
).
How would I create the equivalent join, but instead of joining onto PRASSET
's primary key, join on to another field instead?
David have a look on following link, as i thing that it might help
Fluent NHibernate - Mapping a property to a column on a joined table
also this might help
ReferencesAny(x => x.Author)
.EntityTypeColumn("Type")
.EntityIdentifierColumn("Id")
.IdentityType<int>();
See more here.
Hope this helps... and now really holliday :) see u
精彩评论