views:

132

answers:

0

Hello,

I have just started to look at the caching block which sounds very promising but am having trouble getting it to work with a DataBackingStore. It works fine with a NullBackingStore but when I switch to data, I get the following error when trying to create the CacheManager from the CacheFactory:

The type 'Microsoft.Practices.EnterpriseLibrary.Caching.Database.DataBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching.Database, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' cannot be resolved. Please verify the spelling is correct or that the full type name is provided.

I am referencing Microsoft.Practices.EnterpriseLibrary.Caching.dll, Microsoft.Practices.EnterpriseLibrary.Caching.Database.dll and Microsoft.Practices.EnterpriseLibrary.Common.dll which I believe is all I need.

I have tried with version 4 and version 5 of EntLib but got the same errors.

Here is the contents of my App.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
  <dataConfiguration defaultDatabase="Connection String" />
  <connectionStrings>
    <add name="Connection String" connectionString="Data Source=LOCALHOST;Initial Catalog=Caching;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <cachingConfiguration defaultCacheManager="Cache Manager">
    <cacheManagers>
      <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
          numberToRemoveWhenScavenging="10" backingStoreName="Data Cache Storage"
          type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          name="Cache Manager" />
    </cacheManagers>
    <backingStores>
      <add databaseInstanceName="Connection String" partitionName="MyApp"
          encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.Database.DataBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching.Database, Version=4.1.0.0, Culture=neutral,    PublicKeyToken=31bf3856ad364e35" name="Data Cache Storage" />
    </backingStores>
  </cachingConfiguration>
</configuration>

Any Ideas?

EDIT: I have just noticed that it works fine in a web app but not in a WPF app. Has anyone successfully used the EntLib Caching Block with a db backing store in WPF?