Show / Hide Table of Contents

    Model

    Model is the short for the Data Model class or object which represents the application data entry.

    1. It can map the application data entry to a database entry (for example, table, view, stored procedure, or a SQL query) by applying attributes to the class or property.

      For example, to query the result set from a database, you can apply TableAttribute or FromTableAttribute to the class which defines the table it maps to, then apply SqlWhereAttribute to the class that defines the search condition for the SQL SELECT statement, and use SqlParameterAttribute to make the SQL statement parameterized. To save data changes to the database, you can apply KeyAttribute to one or more properties in the class that defines the primary key in the database, or apply PropertySaveAttribute to define how to save the property to the database.

    2. It can define the relationship between one application data entry and another.

      For example, there is a master-detail relationship between the department and courses, then you can apply EmbededModelAttribute to a property, which represents the courses, in the department class.

    3. After the model class is instantiated, a model object can represent a row of the application data entry, such as a department, a course, a customer etc.

    Back to top Generated by Appeon