Share via


ObjectContext.TryGetObjectByKey(EntityKey, Object) Method

Definition

Returns an object that has the specified entity key.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")]
public virtual bool TryGetObjectByKey (System.Data.Entity.Core.EntityKey key, out object value);
abstract member TryGetObjectByKey : System.Data.Entity.Core.EntityKey *  -> bool
override this.TryGetObjectByKey : System.Data.Entity.Core.EntityKey *  -> bool
Public Overridable Function TryGetObjectByKey (key As EntityKey, ByRef value As Object) As Boolean

Parameters

key
EntityKey

The key of the object to be found.

value
Object

When this method returns, contains the object.

Returns

true if the object was retrieved successfully. false if the key is temporary, the connection is null, or the value is null.

Attributes

Exceptions

Incompatible metadata for key .

key is null.

Applies to