views:

212

answers:

0

I'm new to the Active Record design pattern and usually use a Data Mapper type pattern.

The project I'm currently working on seems to meet nicely with the requirements for using the Active Record pattern in that the domain is fairly small and the object and database schemas are quite similar (though not identical obviously).

I plan on having a WCF layer which basically provides instances of persisted objects in the domain.

If my understanding is correct, all of my data access code goes into methods within the domain classes when using Active Record, so the object is able to statically create instances of itself as well as persist itself.

I want to use the auto code generation within Visual Studio (ie Add Service Reference), which seems to create copies of my domain objects on the client end (assuming they're used by the WCF service).

The problem I see here now is that the client has objects which offer access to the database, but the database doesn't exist on the client (nor should references to the data access assemblies).

Is there any easy way that I can go about ensuring the code on the client doesn't have access to these Active Record pattern methods without needing to change tonnes of code if/when domain class definitions change?

Is there a better way to do what I want to do? Should I stick with the Data Mapper pattern?