次の方法で共有


ObjectContext.TryGetObjectByKey メソッド

[このページは、Entity Framework 6 に関するページです。最新バージョンは、'Entity Framework' NuGet パッケージとして入手できます。Entity Framework の詳細については、msdn.com/data/ef を参照してください。]

指定されたエンティティ キーを持つオブジェクトを返します。

名前空間:  System.Data.Entity.Core.Objects
アセンブリ:  EntityFramework (EntityFramework.dll 内)

構文

'宣言
<SuppressMessageAttribute("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")> _
Public Overridable Function TryGetObjectByKey ( _
    key As EntityKey, _
    <OutAttribute> ByRef value As Object _
) As Boolean
'使用
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

パラメーター

  • value
    型 : System.Object%
    このメソッドから制御が戻った時点で、オブジェクトが格納されます。

戻り値

型 : System.Boolean
オブジェクトが正常に取得された場合は true。key が一時キーの場合、接続が null の場合、または value が null の場合は false。

例外

例外 状態
ArgumentException

key のメタデータに互換性がありません。

ArgumentNullException

key が null です。

参照

参照

ObjectContext クラス

System.Data.Entity.Core.Objects 名前空間