TheChampp
TheChampp

Reputation: 1437

ADO.NET Entity Data Model (Entity object)

I have entity instance(north)

NorthdatabaseEntity north = new NorthdatabaseEntity()

The problem is that i don't have access to ObjectContext methods. I tried to call them with object "north" but i didn't found the method "AddObject" or any other from ObjectContext. I thought that any entity object has all methods from ObjectContext class.

Where is the problem here?

Upvotes: 1

Views: 996

Answers (1)

daryal
daryal

Reputation: 14919

ObjectContext and entities are different objects; you may use ObjectContext to add/modify/delete objects, but entities does not have direct access to ObjectContext.

You need to create an instance of ObjectContext and perform your operations on itself, not on entities.

Upvotes: 1

Related Questions