官术网_书友最值得收藏!

Models

Unlike the other MVVM components, the Model constituent comprises of a number of elements. It encompasses the business data model along with its related validation logic and also the Data Access Layer (DAL), or data repositories, that provide the application with data access and persistence.

The data model represents the classes that hold the data in the application. They typically mirror the columns in the database more or less, although it is common that they are hierarchical in form, and so may require joins to be performed in the data source in order to fully populate them.

One alternative would be to design the data model classes to fit the requirements in the UI, but either way, the business logic or validation rules will typically reside in the same project as the data model.

The code that is used to interface with whatever data persistence technology is used in our application is also included within the Models component of the pattern. Care should be taken when it comes to organizing this component in the code base, as there are a number of issues to take into consideration. We'll investigate this further in a while, but for now, let's continue to find out more about the components in this pattern.

主站蜘蛛池模板: 锦屏县| 乌恰县| 化州市| 鄂温| 磐安县| 江西省| 台湾省| 逊克县| 东兰县| 来凤县| 仁布县| 资源县| 尼勒克县| 鄂托克前旗| 舟山市| 三都| 沁源县| 柳州市| 陇川县| 慈利县| 嵊州市| 南雄市| 静海县| 桓仁| 蒲城县| 镇沅| 弥勒县| 虞城县| 宁国市| 德昌县| 咸宁市| 永济市| 雷山县| 蕉岭县| 鄄城县| 南部县| 白朗县| 沽源县| 布尔津县| 蓬安县| 广宗县|