views:

503

answers:

2

I have implemented a generic IPropertyChangedNotifier using castle dynamic proxy. Here I intercept setter call in Proxy objects so that i don't have to raise PropertyChanged event in setters of my domain objects.

The purpose was to use these proxy objects to bind it UI in a silevrlight application.

The Problem is serialization of proxy object fails in WCF service call which is due to absence of [DataContract] on proxy object. to get around the problem I had to keep a copy of instance in my interceptor and send this object for serialization.IPropertyChangedNotifier

This has resulted in complicated code which is difficult to debug or understand. Is there a simple way to solve the serialization problem in WCF to tell the serializer to use [DataContract] attribute of base class(instance) while sending a proxy in service call.

A: 

What if you cast to the base class type?

John Saunders
The WCF service client passes an array of objects as parameter hence casting to base class doesn't help.
Deepak N
Just to be sure: you tried this and it didn't work?
John Saunders
yes .. even after casting serializer uses GetType() on proxy object
Deepak N
A: 

We Dropped DynamicProxies and now using PostSharp for Generic IPropertyChangedNotifier. No probs with serialization...

Deepak N