How to use Classes As List Collection in Azure AppFabric Caching -


h, using windows azure appfabri caching. have 2 project in asp.ne t . 1 put data in cache , 2nd read cache. these 2 project running on 2 different systems. have 4 dll included in these projects.

microsoft.windowsfabric.common.dll microsoft.windowsfabric.data.common.dll microsoft.applicationserver.caching.client.dll microsoft.applicationserver.caching.core.dll 

poject 1: insert data in cache using following code:data saving cache successfully

default.aspx.cs:

using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using microsoft.applicationserver.caching;  public partial class default2 : system.web.ui.page {     public class employee     {         public string name { get; set; }         public decimal salary { get; set; }      }     protected static datacachefactory _factory = null;     protected static datacache _cache = null;     protected void page_load(object sender, eventargs e)     {         putdataintocache();      }     protected void putdataintocache()     {         list<employee> emp = new list<employee>();         try         {              emp.add(new employee { name = "james", salary = 20000 });             putcacheitem("55", emp);          }         catch (exception ex)         {          }     }     protected void putcacheitem(string key, object value)     {          try         {             _cache = getdefaultcache();             _cache.put(key, value);         }         catch (exception ex)         {           }     }     protected static datacache getdefaultcache()     {         _factory = new datacachefactory();         _cache = _factory.getdefaultcache();         return _cache;      }  } 

now reading cache in project running on system. code given below:

default.aspx.cs:

using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using microsoft.applicationserver.caching;  public partial class default2 : system.web.ui.page {     protected static datacachefactory _factory = null;     protected static datacache _cache = null;     protected void page_load(object sender, eventargs e)     {         getdatafromcache();      }     protected void getdatafromcache()     {         _cache = getdefaultcache();         string key = "55";         var item = _cache.get(key);// error generation here     }      protected static datacache getdefaultcache()     {         _factory = new datacachefactory();         _cache = _factory.getdefaultcache();         return _cache;      }  } 

an error generating on line _cache.get(key)

the deserializer cannot load type deserialize because type 'system.collections.generic.list`1[[_default2+employee, app_web_4xzswv4j, version=0.0.0.0, culture=neutral, publickeytoken=null]]' not found in assembly 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089'. check type being serialized has same contract type being deserialized , same assembly used. 

why error coming? how can can uses classes list collection add/read in cache.

i believe problem second project doesn't define employee class. should define class library employee in , reference same assembly both projects.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -