Sunday 15 January 2012

How do I create this reference mapping in Fluent NHibernate? -


To use Fluent NHibernate, I need a clue how to map my invoice class. Public class buyer {public virtual id id (get; set;} public virtual string {get; set;} public virtual string tax reggae {not; set;} // more property ...} public class invoices {public virtual id id {get; set;} public virtual it idee {receives; set;} public virtual buyer buyer {get; set;} // more properties}

The problem is that I have to be in the invoice class:

  • Buyer ID - Only one integer ID reference and foremost key relationships
  • A copy of almost all buyer properties (its accounting documents and properties can not be changed after confirmation) - As a component
  • I did the following mapping but this does not work

      public invoicemark () {id (x => x.Id); references (x = & Gt; x.IdBuyer); component (x = & gt; x. Buyer, buyer map, columnpix ("buyer_")); // .... more properties}  

You usually have both foreign keys and If the child object maps to both of you, then do it in mapping (or similar):

  context (x = & gt; X.buyer); Map (x = & gt; x.IdBuyer). Columns ("Buyer ID"). No. Indrat (). Not.Update ();  

Then you do not repeat the name of the columns in SQL statements, which results in the number of parameters which have mismatched errors.


No comments:

Post a Comment