Generate Constructor based on Primary Key

Topic updated 4-4-2007

This template option is part of the Table Template Options. It allows you to control whether the POCO class should contain an extra constructor based on the Column of the mapped Table Primary Key.

This option is also automatically turned off when the mapping Table has no primary key.
 

Books Example

The Books table Primary Key (PK) consists of 1 Column : ISBN Number.

If this template option is turned ON --> the following constructor is going to be generated. Otherwise, this method is not generated and the only constructor is the basic parameter-less one.

               /// <summary>

               /// Create a new instance/object

               /// </summary>

               public Books(System.String pISBNNumber)

               {

                       this._ISBNNumber = pISBNNumber;

               }