[EF + Oracle]Object Context


After EF episodes I and II, we are going to see the Object Context.

What is Object Context?

It is a class which manages the DB connection, and the different Entities of our model.

When Visual Studio creates the EF model, like I explain previously, also generates a Class that extends ObjectContext.

ObjectContext provides:

- DB connection

- Add, update and delete functions.

- Object Sets of Entities.

- State of Pending Changes.

This class will give a function, for each Entity, like 

Esta clase va a contar con una función, para cada entidad, del tipo “AddTo{ENTITY}({Entity_Type } value)”, which are going to add a Entity to the related ObjectSet.

In addition, it has a property, for each Entity, like “ObjectSet<TEntity> Entity”, does will keep the related record set. It will be filled with the CreateObjectSet<TEntity> function of Base class (ObjectContext).

What is an ObjectSet?

It is a class that allows us to manage the Entity Set from a Type.

It inherits from:

· ObjectQuery<TEntity>

· IObjectSet<TEntity>

· IQueryAble<TEntity

· IEnumerable<TEntity

· IQueryAble

· IEnumerable

An ObjectSet is a class property that allows query, insert, delete and update records from a determinate Entity.

In following chapters we will see how to query Entities.


A very important property of the Context is “LazyLoadingEnabled”. This Boolean property lets indicate if the data loading is lazy, in other words, the Object will not be created and query until not be needed.


In this post we have seen what the VS generated context is, some of the characteristics, and where to see Entity data.

In next chapters we will see, CRUD operations, and how to query ObjectSets.

posted on Thursday, March 3, 2011 3:53 PM Print
No comments posted yet.

Post Comment

Title *
Name *
Comment *