The following graphic shows the Parent settings available for a given root object. Parents are listed for each root object that is referenced by the selected object through a foreign key. In this example, the Contact object is listed as a Parent of the selected Student root object because the column FKContactId is defined as a foreign key within the Student table.
If instead you select the Contact object the Student object is listed under Contact's Children node. You will also notice that
Teacher is also a Child of Contact in the OleroTraining database.
The settings you can modify on a Parent object are explained below:
Foreign Key: Default: name of foreign key column
This read-only setting displays the name of the foreign key column which references the Parent object within the selected table objects definition.
Parent Object Name: Default: mapped Database table name
This setting changes the name that the Parent will be referenced by the Child object. This setting will not change the name of the root object but rather only how the object will be referenced within the context of the selected Child object. For example changing the Parent Object Name for the Parent object Contact to AddressInfo will only change the way the Student object references Contact (i.e. Student.AddressInfo). The Contact object will not be changed.
Get Accessor Scope: Default: public virtual
Set Mutator Scope:
Get Accessor Scope – Determines the visibility and which classes/subclasses can view data associated with the Parent object in the context of the Child object.
Set Accessor Scope – Determines the visibility and which classes can modify the values within this object within the context of the Student object.
The possible values for both Get Accessor Scope 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 |
Required: Default: not enabled
Enabling this checkbox will modify the New[Object] method signature to force a valid Parent object type to be supplied when the object is instantiated. For example, if the Parent Contact object’s Required setting is enabled the NewStudent() method will be changed to the following when the Data Layer is generated and compiled again:
//Return an existing contact object
Contact contact = dm.GetContact();
// Default NewStudent method
Student student = dm.NewStudent();
// NewStudent() method if Required is enabled on Parent Object of Student
Student student = dm.NewStudent(contact);
The only information viewable for a Parent object is the Foreign key which relates the two tables.