Hi Christian I'd recommend using AutoMapper to map your AR objects to your view models. This is the best solution no matter what persistence framework you are using. You can leave the persistence layer out completely for testing and visual design.
DDD fans might even introduce a separated domain model layer, so you have three model layers in your app: persistence model layer <- AR,NHibernate, EF, L2SQL, ... (AutoMapper) domain model layer <- POCO without ANY concessions (virtual members, IESI etc.) (AutoMapper) ViewModel <- IPropertyChanged, validation attributes, optimized for GUI - Markus 2011/2/22 smiler <[email protected]>: > 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.
