DesignPattern_AspNet_Part6
来源:互联网 发布:java语言基础教程pdf 编辑:程序博客网 时间:2024/06/05 20:04
Data Access Layer
Remember :
· Data Access Layer shall NOT contain any business logic.
· Should ONLY access via business layer by interfaces
Patterns:
· Repository Pattern
· Data Access Object (1 – 1mapping)
· Unit Of Work :
Before commit , store all changes in memory, if exception any occurs during committing then roll back.
· Data Concurrency
1. Last Change Wins
2. When an entity is being saved to the database, the version of the changed entity is included in the where clause.If the versions do not match, no update occurs, and the ExecuteNonQuerymethod() returns a zero records affected count.
· Lazy Loading
When load one object may not want the entire information , so can defer load other information when needed .but only need to know how to get them .
· Proxy
1. can perform logic before calling the real object
2. can perform lazy loading
3. cache
· Identity Map
Ensure each object only instanced once in the same transaction . by Cache the data in dictionary .
· Query Object Pattern
A Object that represent aquery .