‘__Entities’: type used in a using statement must be implicitly convertible to ‘System.IDisposable’
March 21, 2012
Posted by on
I have a solution where my working project references the project having the Entity Data Model. When I create the entity model context with the using statement I get the following compiler error.
Error 2 ‘Intrado.Data.MyEntities’: type used in a using statement must be implicitly convertible to ‘System.IDisposable’ C:\Saravanan\MyApp\MyApp.Service.cs 16 13 MyApp.Service
We can find this issue when the entity model is in a different project than the working project. We get this exception since the Compiler knows till the point that the entity class (MyEntities in my example) is derived from ObjectContext. For some reason C# compiler can’t understanding that ObjectContext has implemented the IDisposible.
To resolve it, simply add a reference to the System.Data.Entity in the working project. This should take care of this error.