May 4, 2011 at 1:28 pm
Folks,
We have a couple of developers utilizing the Microsoft Entity Framework 4.0 for their development efforts. I have constructed numerous stored procedures for them to use in reading/writing data to the database and I have tried my best to support them in their efforts to get this working.
Most of what we've done seems to work satisfactorily, however they are asking me to help them figure out one piece which they've been unable to resolve.
When their app fires up, it instantiates a number of data objects which fetch data from the SQL Server. However, we have multiple applications which can update the underlying database independently of the application they are developing.
When an EF data object gets created and it retrieves a collection of data records and displays them, how can the EF detect that the data it might have cached in one of its collections has been updated in the underlying datastore? Does this functionality have to manually implemented somehow? One of the developers tells me that there isn't any kind of "refresh" method on an entity which she knows of.
It seems like Microsoft had to include some way for the Framework to detect this kind of condition and provide mechanisms for having the Framework refresh any entities that is currently has cached internally.
Has anyone else dealt with this kind of scenario yet? If so, I'd love to read about how you resolved this kind of issue.
Many thanks in advance!
Larry Kruse
May 6, 2011 at 7:52 am
Beulher? Anyone?
May 6, 2011 at 1:29 pm
I don't think that there is an automated refresh of cached EF objects. EF is running client side and knows when an object has been changed by the application, but can't know the underlying data source has changed without querying it. You can use the Refresh method of the ObjectContext to do this. This article might help. You also might get better answers for a question like this on StackOverflow or on the .NET forums on MSDN
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
May 9, 2011 at 6:28 am
Many thanks for the tips and suggestions Jack!
I will go explore around the sites you referenced. Thanks for pointing me in their direction.
Larry
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply