In my use case i have to use the same model as response for my WCF service and in the same time i have to cache it into redis.
Just part of this object has to be serialized for the WCF response, while the whole object has to be stored into the Redis cache.
Redis uses the decoration [Serializable] while the WCF the [DataContract] which allows me to select the property i want to serialize.
[Serializable]
[DataContract]
public Model {
[DataMember (Name = "prop1")]
public string property1 {get; set;}
[DataMember (Name = "prop2")]
public property2 {get; set;}
[DataMember (Name = "prop3")]
public property3 {get; set;}
public property4 {get; set;}
public property5 {get; set;}
}
What i would like to get is : prop1, prop2, prop3 for the wcf response while i would put the whole object inside redis. What i currently get is an exception from redis which cannot read some properties:
$exception {"Unable to read the cache object with key 'userfiltered_323041' before the timeout."} System.TimeoutException
all public members must mark DataMemberAttribute or IgnoreMemberAttribute. type: MyType member:MyTypeName
Is it possible to instruct Redis to use one serializer and the WCF another one?