Caching Block with database - databackingstore cannot be resolved

Topics: Caching Application Block , Data Access Application Block
Jul 23, 2010 at 4:37 PM

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?

Thanks,
Nick

 

Jul 26, 2010 at 1:52 AM
Edited Jul 26, 2010 at 6:53 AM

Are you editing your config using the entlib configuration tool?  Are you able to open your config in the config tool without any errors?

I actually don't see anything wrong with your config and I'm unable to repro.  Could you send a small project which replicates the error?

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 26, 2010 at 9:45 AM
Hi Sarah,

Thanks for your reply. I have done a bit more research and found that it works ok for me in a web app but not in a WPF app. Please see attached for a basic WPF project that recreates the error.

Thanks,
Nick

On 26 July 2010 02:52, AvanadeSupport <notifications@codeplex.com> wrote:

From: AvanadeSupport

I don't see anything wrong with your config and I'm unable to repro.  Could you send a small project which replicates the error?

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Jul 26, 2010 at 9:50 AM

Thanks for your reply, I have discovered that the error only occurs in a WPF app and is fine in a web app. I have emailed you a project.

 

Thanks,

Nick

Jul 26, 2010 at 10:18 AM
Edited Jul 26, 2010 at 10:19 AM

Did you use .zip or .rar format? Use .zip format if you didn't. Could you check if receive a message sending failure coz I haven't received it yet.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 26, 2010 at 10:38 AM
I used .rar, didn't get any failure messages back. Can send in .zip if you like?

On 26 July 2010 11:18, AvanadeSupport <notifications@codeplex.com> wrote:

From: AvanadeSupport

Did you use .zip or .rar format?  Could you check if receive a message sending failure coz I haven't received it yet.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Jul 27, 2010 at 12:39 AM

Hi,

We still haven't received your sample project. Yes, could you try sending it as .zip file.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jul 27, 2010 at 12:00 PM
Hi Gino,

Sorry for the delay. Here is the .zip file.

Thanks,
Nick

On 27 July 2010 01:39, AvanadeSupport <notifications@codeplex.com> wrote:

From: AvanadeSupport

Hi,

We still haven't received your sample project. Yes, could you try sending it as .zip file.

Gino Terrado


Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Jul 28, 2010 at 2:26 AM

We still haven't received your email but I think this is what's happening.  Your wpf project can't find its configuration file.  I noticed that when you add a configuration file in a WPF project, the default name is App1.config.  So, is your configuration file named App1.config?  If yes, then rename it to App.config.  Console, winforms, wpf project, etc. specifically looks for an app.config file as its configuration file.

Sarah Urmeenta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 8, 2010 at 1:55 AM

Well, I got the same problem. DataBackingStore doesn't work well in my WPF project. Same error.

As a comment, after have been referenced the assemblies (All necessaries) the compiler doesn't recognize "using Microsoft.Practices.EnterpiseLibrary.Caching.Database;". Is it normal?

Note: I can use DatabackingStore in a windows form application.

Cheers,

Oct 8, 2010 at 2:10 AM

Are you using the 5.0 version? If yes, right click on your project and see if the Target Platform is set to full .net framework rather than .NET client profile.

Since you're encountering a compile error, I'm wondering if you're also encountering the runtime exception originally posted by nreeve.  If yes, have you renamed your configuration file to app.config?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 8, 2010 at 2:26 AM

Hi Sarah,

I've changed target platform to framwork 4 full and now is working, thanks! I am using ent lib 5.

Any logic reason why we need change to full.net framework?

Cheers,

 

Oct 8, 2010 at 2:31 AM

The reason is because DAAB has dependencies on System.Data.Oracle assembly which is not included in the .NET Client profile.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Feb 28, 2013 at 12:31 PM
Edited Feb 28, 2013 at 12:32 PM
The issue is that you need to include the Enterprise Library Caching Database Application Block.

Richard Lee
Avant Prime
(http://codecanyon.avantprime.com)