Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit of Work Edmonton Code Camp Oct 2007 Presenter: Neil Bourgeois.

Similar presentations


Presentation on theme: "Unit of Work Edmonton Code Camp Oct 2007 Presenter: Neil Bourgeois."— Presentation transcript:

1 Unit of Work Edmonton Code Camp Oct 2007 Presenter: Neil Bourgeois

2 Layered Architecture Presentation Domain Data Access Service

3 Transaction Script Anemic Domain Service Layer gets cluttered with business logic and Data Access Layer CRUD Difficult to keep Domain persistence ignorant Difficult to make transactional

4 Unit of Work Tracks everything done during a business transaction Figures out which CRUD actions need to be applied to persist changes Completes changes in a database transaction

5 Implications New objects need to be registered with UoW Objects loaded from database need to be registered with UoW Need to know when objects change Service Layer never calls Data Access layer directly

6 Repositories Abstraction of the database New and Existing objects are created through a repository Repository registers New and Existing objects with UoW Domain objects can use repositories to find other domain objects

7 Object State Per object change observer Possible States: New Clean Dirty Remove Persisting

8 Identity Map Keeps track of domain objects loaded through repositories Keeps track of object state

9 Workspace Transaction Per Session (HttpRequest) Thread Safe Contains Identity Map Manages persistence

10 Lets Code!


Download ppt "Unit of Work Edmonton Code Camp Oct 2007 Presenter: Neil Bourgeois."

Similar presentations


Ads by Google