Share via


Metodo ObjectContext.TryGetObjectByKey

[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]

Restituisce un oggetto contenente la chiave di entità specificata.

Spazio dei nomi:  System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

Sintassi

'Dichiarazione
<SuppressMessageAttribute("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")> _
Public Overridable Function TryGetObjectByKey ( _
    key As EntityKey, _
    <OutAttribute> ByRef value As Object _
) As Boolean
'Utilizzo
Dim instance As ObjectContext 
Dim key As EntityKey 
Dim value As Object 
Dim returnValue As Boolean 

returnValue = instance.TryGetObjectByKey(key, _
    value)
[SuppressMessageAttribute("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")]
public virtual bool TryGetObjectByKey(
    EntityKey key,
    out Object value
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1007:UseGenericsWhereAppropriate")]
public:
virtual bool TryGetObjectByKey(
    EntityKey^ key, 
    [OutAttribute] Object^% value
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")>]
abstract TryGetObjectByKey : 
        key:EntityKey * 
        value:Object byref -> bool 
[<SuppressMessageAttribute("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")>]
override TryGetObjectByKey : 
        key:EntityKey * 
        value:Object byref -> bool
public function TryGetObjectByKey(
    key : EntityKey, 
    value : Object
) : boolean

Parametri

  • value
    Tipo: System.Object%
    Quando termina, questo metodo contiene l'oggetto.

Valore restituito

Tipo: System.Boolean
true se l'oggetto è stato recuperato correttamente.false se key è temporaneo, connessione è Null o value è Null.

Eccezioni

Eccezione Condizione
ArgumentException

Metadati incompatibili per key.

ArgumentNullException

key è Null.

Vedere anche

Riferimento

ObjectContext Classe

Spazio dei nomi System.Data.Entity.Core.Objects