ActiveRecord can be fully used without inheriting ActiveRecordBase, see
http://www.castleproject.org/activerecord/documentation/trunk/advanced/mediator.html
<http://www.castleproject.org/activerecord/documentation/trunk/advanced/mediator.html>Instead
of using the static methods e.g. Post.FindAll(), apost.Save(), etc, you call
ActiveRecordMediator.
Also you may wrap ActiveRecordMediator in a repository interface, see
http://fatagnus.com/using-the-repository-pattern-with-activerecord-from-castle/

--
Mauricio



On Tue, Feb 22, 2011 at 10:34 AM, smiler <[email protected]> wrote:

> Hello,
>
> I'm currently developing a WPF application using the MVVM pattern and
> I'm looking for a way to separate my Active Record (AR) classes in my
> model from the rest of my application. Currently I have a few classes
> mapped to my database and some methods creating an interface for my
> persistence layer. My problem is that these methods uses the AR
> classes and thus exposes the rest of my application (both the view-
> model and the view) with all AR methods (i.e the CRUD functionality).
> This makes it impossible to mock the persistence layer (which I need
> both for testing the view-model and for using visual studios/
> expression blends design mode).
>
> I found a somewhat old article [1] on the web that kind of describes
> the separation problem in better words but I'm left without a
> solution. Any tips or hints on how to proceed with this are
> appreciated.
>
>
> [1]
> http://www.lostechies.com/blogs/nelson_montalvo/archive/2007/04/16/castle-s-activerecord-not-for-the-domain-purist-in-you.aspx
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to