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 ?

H H
  • 263,252
  • 30
  • 330
  • 514
anishMarokey
  • 11,279
  • 2
  • 34
  • 47

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
  • 178,213
  • 47
  • 333
  • 501
  • 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