Model
Model is the short for the Data Model class or object which represents the application data entry.
- 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 - TableAttributeor- FromTableAttributeto the class which defines the table it maps to, then apply- SqlWhereAttributeto the class that defines the search condition for the SQL SELECT statement, and use- SqlParameterAttributeto make the SQL statement parameterized. To save data changes to the database, you can apply- KeyAttributeto one or more properties in the class that defines the primary key in the database, or apply- PropertySaveAttributeto define how to save the property to the database.
- 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 - EmbededModelAttributeto a property, which represents the courses, in the department class.
- 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.