I read the book. Reached the Entity-framework. And it turns out such a problem. In the book, the class that is obtained after creating the Entity-framework element is inherited from ObjectContext

 public partial class AutoLog1Entities : ObjectContext 

And when I create a new Entity-framework element and automatically fill it with data from a table, for some reason my class becomes DbContext successor DbContext

 public partial class AutoLog1Entities : DbContext 

Therefore I can not do anything. Since the methods that are in ObjectContext missing in DbContext . I understand that this depends on the EF version (but this is not accurate), but I cannot find the version that uses ObjectContext instead of DbContext

    1 answer 1

    Since version 4.1, DbContext is an analogue of ОbjectContext , they are almost identical in functionality. Of course, there is a difference in working with them and it will be easier to re-create the project for the old version if you want to follow the book.

    More details can be found in the articles: Article # 1 Article # 2

    • They are "almost" identical only in appearance, and the differences inside them are quite serious. - Pavel Mayorov
    • Mainly, the behavior of the recursive traversal when adding items to navigation collections is different. - Pavel Mayorov