次の方法で共有


ObjectContext.LoadProperty<TEntity> メソッド (TEntity, Expression<Func<TEntity, Object>>, MergeOption)

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

指定した LINQ クエリと指定したマージ オプションを使用して、指定したオブジェクトに関連するオブジェクトを明示的に読み込みます。

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

構文

'宣言
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
Public Overridable Sub LoadProperty(Of TEntity) ( _
    entity As TEntity, _
    selector As Expression(Of Func(Of TEntity, Object)), _
    mergeOption As MergeOption _
)
'使用
Dim instance As ObjectContext 
Dim entity As TEntity
Dim selector As Expression(Of Func(Of TEntity, Object))
Dim mergeOption As MergeOption

instance.LoadProperty(entity, selector, _
    mergeOption)
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public virtual void LoadProperty<TEntity>(
    TEntity entity,
    Expression<Func<TEntity, Object>> selector,
    MergeOption mergeOption
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
public:
generic<typename TEntity>
virtual void LoadProperty(
    TEntity entity, 
    Expression<Func<TEntity, Object^>^>^ selector, 
    MergeOption mergeOption
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
abstract LoadProperty : 
        entity:'TEntity * 
        selector:Expression<Func<'TEntity, Object>> * 
        mergeOption:MergeOption -> unit 
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
override LoadProperty : 
        entity:'TEntity * 
        selector:Expression<Func<'TEntity, Object>> * 
        mergeOption:MergeOption -> unit
JScript does not support generic types and methods.

型パラメーター

  • TEntity
    エンティティの型。

パラメーター

  • entity
    型 : TEntity
    関連オブジェクトを読み込むソース オブジェクト。

例外

例外 状態
ArgumentException

selector は有効な入力パラメーターを指定しません。

ArgumentNullException

selector が null です。

InvalidOperationException

エンティティの状態が Detached、[F:System.Data.Entity.EntityState.Added,]、Deleted のいずれかであるか、またはエンティティが、ObjectContext の別のインスタンスにアタッチされています。

参照

参照

ObjectContext クラス

LoadProperty オーバーロード

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