I was reading an blog entry by Ayende Rahien (aka Oren Eini) again, “Entities, Services and what goes between them…” and one of his commenters asked the following question:

  re: Entities, Services and what goes between them… 2/27/2007 6:44 PM Gustavo Cores Link to heading

@Ayende & @Hammet But doesn’t all this entities not talking to repositories go against the Castle project philosophy (ActiveRecord) which you are part of? Because following the AR model Order.FindByCustomerAndCity(…) would make sense

He answered:

@Gustavo, Yes, what I am talking about contradict the Active Record model. In general, I really like the way AR can infer everything for me, and take away much of boring details of working with NHibernate. That said, my personal belief is that a repository driven approach is a more flexible way to handle the issue. I keep the power of AR, but I can now operate at much greater flexibility, see my article on MSDN to see some of the things that I can do with repositories.

Oren defends his stance further with the following blog entry: “What should I use, NHiberante or Active Record?!

I plan on trying out both mechanisms and, like Oren, decide what’s more important: speed or clean domain objects and testability.

I’ll keep you posted.