ObjectContext.GetObjectByKey Method (EntityKey)

 

Returns an object that has the specified entity key.

Namespace:   System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

public virtual object GetObjectByKey(
	EntityKey key
)

Parameters

key
Type: System.Data.Entity.Core.EntityKey

The key of the object to be found.

Return Value

Type: System.Object

An Object that is an instance of an entity type.

Exception Condition
ArgumentNullException

The key parameter is null.

ObjectNotFoundException

The object is not found in either the ObjectStateManager or the data source.