New Posts New Posts RSS Feed: EFContextProvider<T> should implement IDisposable
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EFContextProvider<T> should implement IDisposable

 Post Reply Post Reply
Author
jtraband View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 19-Sep-2012
Posts: 55
Post Options Post Options   Quote jtraband Quote  Post ReplyReply Direct Link To This Post Topic: EFContextProvider<T> should implement IDisposable
    Posted: 08-Oct-2012 at 9:38am
Agreed, this should probably be fixed in one of the next few releases.

If this worries you for right now, you can directly access the Context object from the EFContextProvider instance, cast it to either an ObjectContext or a DbContext and call dispose on it.

As a side note: 

From the Albarahi "c# 4.0 in a nutshell" book:

 > Although DataContext/ObjectContext implement IDisposable, you can (in general) get away without disposing instances. Disposing forces the context’s connection to dispose—but this is usually unnecessary because L2S and EF close connections automatically whenever you finish retrieving results from a query <<


Back to Top
pawel View Drop Down
Newbie
Newbie
Avatar

Joined: 21-Sep-2012
Posts: 12
Post Options Post Options   Quote pawel Quote  Post ReplyReply Direct Link To This Post Posted: 08-Oct-2012 at 7:34am
EFContextProvider<T> instantiates DbContext which implements IDisposable, but EFContextProvider<T> doesn't implement IDisposable. I think it should.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down