Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EntityFramework gives IDisposable error

I use EF for the back-end DataLayer in my asp.net websites. I create a class library and add the Model in it, reference it and use it from the ASP.NET Website. But this time, I generated the model from database but it seems does not implement IDisposable, and the methods I used to see are not there. DeleteObject , SaveChanges etc. There are only Two tables in the DB and the Model was generated with only the TableSets and two methods AddToTableSet ... Had anybody encountered such a problem? alt text http://techlipse.net/EF-problem.jpg

like image 473
Snoop Dogg Avatar asked Apr 01 '26 05:04

Snoop Dogg


1 Answers

Did you extend the generated ObjectContext and then perhaps rename it in the EDMX? You might be looking at your part of the partial class here without the generated part.

What does the Properties panel say for your EDMX for "Entity Container Name"?

When you right click on Entities and go to definition do you get to the correct generated class?

And lastly, but probably most likely, did you perhaps delete the Reference to System.Data.Entity from the project or not reference it in your web project?

Is you web project even a Web Application project???

like image 135
Ian Mercer Avatar answered Apr 08 '26 06:04

Ian Mercer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!