Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate: Mapping a single column twice

Is it possible to map one column twice using NHibernate?

<property name="CustomerID" index="IX_Customer" not-null="true" />
<many-to-one name="Customer" column="customerid" class="Customer" fetch="join" />

I need to have the raw ID in order to bind a WinForms control which only supports Binding using a value (instead of the Item itself).

 myControl.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", bs, "CustomerID", true));
like image 714
falstaff Avatar asked Jan 26 '12 15:01

falstaff


1 Answers

Yes, just modify

<property name="CustomerID" index="IX_Customer" insert="false" update="false" not-null="true" />
like image 117
hival Avatar answered Nov 13 '22 05:11

hival