views:

67

answers:

1

They seems to be similar.

+4  A: 

They are different.

Active Record Pattern defines An object that wraps a row in a database table or view, encapsulates the data access, and adds domain logic on that data.

In the Repository pattern all of the data access is put in a separate class and is accessed via instance methods. To me, just doing this is beneficial, since data access is now encapsulated in a separate class, leaving the business object to get on with business. This should stop the unfortunate mixing of data access and business logic you tend to get with Active Record.

Check this link for understanding:

http://moleseyhill.com/blog/2009/07/13/active-record-verses-repository/

YoK
Is it true to say that Repository pattern is alternative of Active Record pattern?
afsharm
@afsharm No.... They are completely different, But ya they solve some of common problems :).
YoK