I am using following code to do azure-caching and it works fine...
[Serializable]
public class Person
{
public string First { set; get; }
public string Last { set; get; }
}
[TestClass]
public class AzureCachingTests1
{
private static DataCacheFactory _factory;
[TestInitialize]
public void Setup()
{
_factory = new DataCacheFactory(new DataCacheFactoryConfiguration("mycache"));
}
[TestMethod]
public void TestMethod1()
{
DataCache cache = _factory.GetDefaultCache();
var person = new Person { First = "Jane", Last = "doe" };
const string key = "mykey";
cache.Put(key, person, TimeSpan.FromMinutes(10));
var data = (Person)cache.Get(key);
Assert.AreEqual("Jane", data.First);
}
}
Now in another instance of Visual studio, I run the following code...
[TestClass]
public class AzureCachingTests
{
private static DataCacheFactory _factory;
[TestInitialize]
public void Setup()
{
_factory = new DataCacheFactory(new DataCacheFactoryConfiguration("mycache"));
}
[TestMethod]
public void TestMethod1()
{
DataCache cache = _factory.GetDefaultCache();
const string key = "mykey";
var data = (Person) cache.Get(key); <----- Error here... <--------
Assert.AreEqual("Jane", data.First);
}
}
[Serializable]
public class Person
{
public string First { set; get; }
public string Last { set; get; }
}
This time, I get the following error...
Test method AzureCaching.AzureCachingTests.TestMethod1 threw exception: System.Runtime.Serialization.SerializationException: Assembly 'AzureCaching1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not found.
My class Person is Serializable. Why am I not able to query for the cache in AzureCaching that I cached in AzureCaching1 ??
Please help. thanks