Here is my solution to my problem. In order to successfully run the configuration Silverlight had to create my 2 configuration files in
Silverlight application more not
in the web application implementation (gives me error to have the configuration files on the web, I don't know why).
This files are the configuration caching to my application:
Then add these lines of code in the App.xaml file
this.Startup += this.Application_Startup;
this.UnhandledException += this.Application_UnhandledException;
private static void InitializeCachingConfig()
var configUri = new Uri("/Configuration/Caching.Silverlight.Configuration.xaml", UriKind.Relative);
EnterpriseLibraryContainer.EnterpriseLibraryConfigurationCompleted += (sender, e) =>
throw new InvalidOperationException("Configuration Failed", e.Error);
And finally the code that I use the object cache in LoadCatalogViewModel.cs
var cache = EnterpriseLibraryContainer.Current.GetInstance<ObjectCache>("In-Memory Cache");
var cacheItem = cache["CatalogKey"];
if (cacheItem == null)
cache.Set("CatalogKey", this.Countries, new CacheItemPolicy());
I hope this helps those who have the same problem.
Now I have another question, there is the possibility of exporting to an XML file and have on hard drive, then read them again and not have to go to the database at the time of having my object in cache.
It has Enterprise library this exporter to XML option my object in cache
Any suggestions, thank you