Expanding a selected table object node will display a list of the Properties (mapped columns) for that object with the exception of any foreign key columns. For example, the State property - a mapped column within the Contact table - is shown below.
The right-side pane shows the settings which can be modified for a given Property as well as database attributes such as the underlying column name, SQL and .NET data types, length, and if the column allows nulls.
Primary key columns are indicated in
the settings window as shown below. The ID
column property is the Primary Key of the table object Contact.
Property Name: Default: Mapped Database Column Name
This setting controls how the name of the mapped column should be generated within the data layer.
Set Mutators Scope:
Get Accessor Scope: Default: public virtual
The C# language allows for a form of encapsulation called Properties which control how a class’s data members can be read or modified. Internally a Property is implemented as a pair of get/set methods These internal get_/set_ pairs control how or even if a given Property value can be modified or read.
When ORM.NET generates a data layer for a given database it implements Property method pairs for every column within a mapped table object which has enabled the Include in Code Generation setting.
For example, the column property Address1 will have the following C# Property method implementation by default.
public virtual string Address1
{
get
{
return row["Address1"];
}
set
{
row["Address1"] = value;
}
}
Therefore, changing the Set Mutator Scope and Get Accessor Scope settings determines how the Property method signatures will be created for each mapped column. These settings controls the visibility of Property values – which class types can view a value – and if that Property’s values can be modified.
The possible values for both Get Accessor and Set Mutator Scope are:
public virtual |
(default) Will define the property method as being accessible from an object instance, or any subclass. This setting also indicates that the property method can be overridden by a descended class if desired. |
protected virtual |
This method signature will only allow descendant classes from viewing or setting the property values. |
internal |
Will define a method that is publicly accessible by all objects in an assembly (but not from outside the assembly). |
None |
The method signature for the property will be set to public virtual. However, the internal get and/or set methods will not be generated for the Property. If both Get Accessor Scope and Set Mutator Scope are set to None NO method is generated for the Property at all. Setting Set Mutator Scope to None will create a Property signature which is read-only |
Note: Columns defined as the Primary key for a table cannot have the Get Accessor Scope or Set Mutator Scope settings modified. Primary key columns will generate a Property definition with a public virtual get_ method but without a corresponding set_ method making these properties read-only within the data layer.
Required: Default: Enabled for columns which do not allow null values.
If this checkbox is enabled a value must be supplied in order to insatiate the object. This value is initially retrieved from the database schema definition and is enabled if the mapped column has been defined to NOT Allow Nulls. Regardless of whether nulls are allowed on the column this setting can be overridden. Enabling the Required checkbox will modify the method signature for the generated New[Object] method of the object. For example, enabling the Required checkbox on the State property within the Contact object will change the method signature of the NewContact() method from:
// Default method signature for NewContact()
Contact contact = dm.NewContact();
// method signature when State is required
Contact contact = dm.NewContact("Colorado");
Note: Columns defined to "Allow Nulls" within SQL Server are still required before a row will be inserted into the table. These columns also default the Property's Required setting to be enabled. Changing the Required setting for a Property only affects whether you want to force a value to be passed in at object instantiation when New[Object] is called.
Information settings for the column properties are displayed below: