0

Our application is using Entity Framework(.net 3.5) and singleton . When i update in the back end through procedure. It is not reflecting in the entity context.

I tried with refresh - But it is not refreshing Foreign Key.

How to refresh the entire context in Entity Framework ?

Henk Holterman
  • 250,905
  • 30
  • 306
  • 490
anishMarokey
  • 11,041
  • 2
  • 32
  • 46

1 Answers1

0

Are you trying to Singleton the objectcontext object? I don't recommend that. It is better to instantiate a new objectcontext for each "unit of work." If you do that, your "entity context" will always be up to date.

http://blogs.msdn.com/alexj/archive/2009/05/07/tip-18-how-to-decide-on-a-lifetime-for-your-objectcontext.aspx

Instantiating a context in LINQ to Entities

Community
  • 1
  • 1
Robert Harvey
  • 173,679
  • 45
  • 326
  • 490
  • we tried using (MyContext ctx = new MyContext()) { … } in our repositary class.But this throwing some other error for foreginkey. How to overcome that? – anishMarokey Mar 23 '10 at 14:58
  • Sounds like you might have a problem with your database table. See also http://stackoverflow.com/questions/520065/entity-framework-as-repository-and-unitofwork – Robert Harvey Mar 23 '10 at 15:23