DesignPattern_AspNet_Part6

Data Access Layer

Remember :

·Data Access Layer shall NOT contain any business logic .

·Should ONLYaccess 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 .


你可能感兴趣的:(Pattern)