Caching block 2.0: Using XMLSerializer or DataContractSerializer

Topics: Caching Application Block
Apr 30, 2007 at 12:09 PM

Is there a way to configure the caching block to use a different serializer than it's default?

I have set up a cachemanager with isolated storage and i would like for the cache items to be serialized as XML. I want to cache DataContract classes that i have auto generated using the svcutil.exe tool. Unfortunally, the serializer in the caching block insists on also serializing the PropertyChanged event handler that i have generated using option: svcutil.exe tool /EndableDatabinding.

A fix would be to add a field: NonSerialized() before the eventhandler declaration but since the classes are autogenerated that is not an immediate option. Ideally, I would like the cache manager to serialize my classes to the disc using the DataContractSerializer from .NET 3.

Thank you for your inputs, i'm stuck :(

<cachingConfiguration defaultCacheManager="ServiceAgent">
      <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
        numberToRemoveWhenScavenging="10" backingStoreName="Isolated Storage"
        name="ServiceAgent" />
      <add partitionName="ServiceAgent" encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=, Culture=neutral, PublicKeyToken=12826e4bfef8aa5c"
        name="Isolated Storage" />
Apr 30, 2007 at 12:10 PM
I'm sorry about the formatting of my post.