Understanding the ObjectContext class: The Visual Basic Mapping

Schemas in the Entity Data Model have a Visual Basic counterpart that effectively allows you to write code to work against entities. To understand this, enable the View All Files view in Solution Explorer and expand the Northwind.edmx file. Finally, open the Northwind.designer.vb code file. Similar to the DataContext class in LINQ to SQL, the ADO.NET Entity Framework provides a class named System.Data.Objects.ObjectContext. This class, also referred to as the object context, acts as a reference to the Entity Data Model and encapsulates the entities’ definition so that you can work with entities. It is also responsible for opening and closing connections, persisting data, keeping ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.