Show / Hide Table of Contents

    Primary Table

    Primary table represents the primary database table which a model class is mapped to. We refer to it as Primary Table. You can define only one Primary Table in a model class.

    When TableAttribute is applied to the model class, the table specified by TableAttribute becomes the Primary Table.

    When TableAttribute is not applied in the model class, and there is one or more FromTableAttribute applied to the model class, the table specified by the first FromTableAttribute becomes the Primary Table.

    In other cases, use the class name as the Primary Table.

    When you need to map some columns from the Primary Table, the SqlColumn attribute and Column attribute can be omitted if the property name of the model class is the same as the column name of the database table (case is insensitive).

    When using a data access component (e.g.: SqlModelMapper) to save changes to the database with a model class, it can only update changes to the Primary Table.

    Back to top Generated by Appeon