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

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.

主站蜘蛛池模板: 应城市| 南部县| 宜兰市| 齐齐哈尔市| 庄浪县| 陵川县| 贵港市| 瑞金市| 宜城市| 翼城县| 顺义区| 扎鲁特旗| 历史| 云安县| 潞城市| 徐汇区| 雅安市| 仲巴县| 松阳县| 新宁县| 全南县| 无极县| 呼伦贝尔市| 和静县| 临汾市| 平果县| 福州市| 抚顺县| 蚌埠市| 曲周县| 瑞安市| 丘北县| 桂林市| 双城市| 离岛区| 随州市| 慈溪市| 松江区| 白朗县| 肃北| 琼结县|