Monday, December 10, 2012

Refreshing DomainSource.DomainContext

Refreshing DomainSource.DomainContext

I am working on a silverlight application built using RIA services & Entity framewok.

On save button click after saving the data to the DB I get the attributes from Domain source and have to do some operation on them .

My code is as below

var ctx = (RadiographyContext)this.DomainSource.DomainContext;    foreach (var e in ctx.Energies)             {               // some calculations here             } 

But domain context is not having updated values . Its having the values loaded on page load . How Can I refresh the Domainsource ?

Answers & Comments...

Answer: 1

You need to reload your domain context. silverlight 4 RIA update item in domaindatasource only updates after refresh

Look at the options you have for the LoadBehavior

MergeIntoCurrent: Values from the newly read instance are merged into the cached instance for property values that are unmodified. No changes are lost in this merge.

KeepCurrent: The cached instance is not changed and the newly read instance is discarded.

RefreshCurrent: All members of the cached instance are overwritten with current values from the newly read instance, regardless of whether they have been modified. In addition, the original state of the entity is also set to the newly read instance.

by : Alycehttp://stackoverflow.com/users/1516678




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog