Simple Active Record (No Repository ) == RDG++
Simple Data Mapper (No Repository) == TDG++
Respository Based Active Record = Simple Active Record++
Repository Based Data Mapper = Simple Data Mapper++
Respository (Active Record) = Simple Active Record++
Repository (Data Mapper) = Simple Data Mapper++
When we are using ADO.NET and writing our own DAL, we are not using any ORM.
We are dealing ourself with all dirty work of Data Access
Writing SQL,Connections, Resultset fetching n mapping, exceptions, messaging,
casting, transactions,updating the database schema and domain model ourself
ORMs try to abstract these things out and make our life easy
Linq like language for quering data.
No connection management
No Result set dealing and mapping to Domain Model
No exception handling
No messages to upper layers
No Data type casting
No Transation Mgmt, it is done by UOW and Change Tracker
Database schema and Domain is synched by Code First Migrations
Two Types of Data source Patterns
1. Row Based Patterns
a. Row Data Gateway (No Domain Logic, Only Persistence Logic, Seperate Class for Querying, No Useful Pattern even for CRUD and BREAD)
b. Active Record (Domain Logic, Persisteance Logic, No SOC, Data, Getter, Setters in same Class, Improvment over RDG, used most in CRUD or BREAD scenarios, it is improvment of a)
2. Table Based Patterns
a. Table Data Gateway (No Domain Logic, Only Persistence Logic, Good SOC, Takes Primitive Data Types, Return Connected ResultSets, Not Useful Pattern even for CRUD and BREAD)
b. Data Mapper Pattern (Domain Logic, persistence Logic, Good SOC, Takes Entities/Domianobj/DTO as input, Returns disconnected Entities/DomainObj/DTO, Improvment over TDG, used most in CRUD and Bread, it is an improvment over a)
Above discussion clearly say
Active Record == Improvment over the RDG
Data Mapper == Improvement over the TDG
Active Record == RDG++
Data Mapper == TDG++
Active Record is good for extermely simple CRUD Domains
Data Mapper is good for exetremely complex Domain Centric scenarios
Most ORM provide support for above 2 patterns, both B are best
Rest of the Two Patters are dumb both As are dumb
In ORMs I think we have two types of Implement of ARP and DM Patterns
Intially we have Non-Repository Based half cooked implemenation of B Patterns, these implemetations remove 50% fo the dirty Data Access Job
We still have to do the dirt work of SQL Queries, Transaction Management, Custom UOW Classes, Custom Repositories
Non Repostory based Active Record Pattern
Non Repository based Data Mapper Pattern
Lately we have Repository Based fully cooked implementations of B Patterns, these implementations remove 90% of the dirty Data Access Job,
It prominently the provide, In-memory Repositories, LINQ Querying, UOW, Change Tracker.
Repostory based Active Record Pattern
Repository based Data Mapper Pattern
Simple Active Record (No Repository ) == RDG++
Simple Data Mapper (No Repository) == TDG++
Respository Based Active Record = Simple Active Record++
Repository Based Data Mapper = Simple Data Mapper++
Respository (Active Record) = Simple Active Record++
Repository (Data Mapper) = Simple Data Mapper++
Simple Data Mapper (No Repository) == TDG++
Respository Based Active Record = Simple Active Record++
Repository Based Data Mapper = Simple Data Mapper++
Respository (Active Record) = Simple Active Record++
Repository (Data Mapper) = Simple Data Mapper++
When we are using ADO.NET and writing our own DAL, we are not using any ORM.
We are dealing ourself with all dirty work of Data Access
Writing SQL,Connections, Resultset fetching n mapping, exceptions, messaging,
casting, transactions,updating the database schema and domain model ourself
ORMs try to abstract these things out and make our life easy
Linq like language for quering data.
No connection management
No Result set dealing and mapping to Domain Model
No exception handling
No messages to upper layers
No Data type casting
No Transation Mgmt, it is done by UOW and Change Tracker
Database schema and Domain is synched by Code First Migrations
Two Types of Data source Patterns
1. Row Based Patterns
a. Row Data Gateway (No Domain Logic, Only Persistence Logic, Seperate Class for Querying, No Useful Pattern even for CRUD and BREAD)
b. Active Record (Domain Logic, Persisteance Logic, No SOC, Data, Getter, Setters in same Class, Improvment over RDG, used most in CRUD or BREAD scenarios, it is improvment of a)
2. Table Based Patterns
a. Table Data Gateway (No Domain Logic, Only Persistence Logic, Good SOC, Takes Primitive Data Types, Return Connected ResultSets, Not Useful Pattern even for CRUD and BREAD)
b. Data Mapper Pattern (Domain Logic, persistence Logic, Good SOC, Takes Entities/Domianobj/DTO as input, Returns disconnected Entities/DomainObj/DTO, Improvment over TDG, used most in CRUD and Bread, it is an improvment over a)
Above discussion clearly say
Active Record == Improvment over the RDG
Data Mapper == Improvement over the TDG
Active Record == RDG++
Data Mapper == TDG++
Active Record is good for extermely simple CRUD Domains
Data Mapper is good for exetremely complex Domain Centric scenarios
Most ORM provide support for above 2 patterns, both B are best
Rest of the Two Patters are dumb both As are dumb
In ORMs I think we have two types of Implement of ARP and DM Patterns
Intially we have Non-Repository Based half cooked implemenation of B Patterns, these implemetations remove 50% fo the dirty Data Access Job
We still have to do the dirt work of SQL Queries, Transaction Management, Custom UOW Classes, Custom Repositories
Non Repostory based Active Record Pattern
Non Repository based Data Mapper Pattern
Lately we have Repository Based fully cooked implementations of B Patterns, these implementations remove 90% of the dirty Data Access Job,
It prominently the provide, In-memory Repositories, LINQ Querying, UOW, Change Tracker.
Repostory based Active Record Pattern
Repository based Data Mapper Pattern
Simple Active Record (No Repository ) == RDG++
Simple Data Mapper (No Repository) == TDG++
Respository Based Active Record = Simple Active Record++
Repository Based Data Mapper = Simple Data Mapper++
Respository (Active Record) = Simple Active Record++
Repository (Data Mapper) = Simple Data Mapper++
No comments:
Post a Comment