c# - WCF / Entity framework update -


i building n-tier application have wcf service (not data / ria services) hosted on web project on iis server, , windows phone client service reference pointing on wcf service.

my wcf service access database through entity framework.

here problem : when update database anywhere client, update cannot seen in clients. when update database specific client, modifications can seen him.

but after while, clients have access updated data.

i believe can caused iis caching of wcf's datas, or caching @ linq level, problem remains after disabling iis caching.

any idea on how fix this?

thanks

so turn in formal anwer:

the framework attempt cache values (not iis). so, ensure not extending unit of work beyond scope of transaction (i.e. using both same , retrieve method(s)). also, try re-establishing context between store/retrieve calls should remove existing caching may occurring within framework. i.e.

[operationcontract] public void save(myobject entity) {   using (myentities db = new myentities())   {     db.myobjects.add(entity);     db.savechanges();   } }  [operationcontract] public myobject single(int32 id) {   using (myentities db = new myentities())   {     return db.myobjects.single(x => x.id == id);   } } 

as opposed to:

[servicecontract] class myservice {   private myentities db = new myentities();    [operationcontract]   public void save(myobject entity)   {     this.db.myobjects.add(entity);     this.db.savechanges();   }    [operationcontract]   public myobjectfind(int32 id)   {     return this.db.myobjects.single(x => x.id == id);   } } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -