ObjectContext.LoadProperty Method

 

Explicitly loads a referenced entity or collection of entities into the given entity.

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

NameDescription
System_CAPS_pubmethodLoadProperty(Object, String)

Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option.

System_CAPS_pubmethodLoadProperty(Object, String, MergeOption)

Explicitly loads an object that is related to the supplied object by the specified navigation property and using the specified merge option.

System_CAPS_pubmethodLoadProperty<TEntity>(TEntity, Expression<Func<TEntity, Object>>)

Explicitly loads an object that is related to the supplied object by the specified LINQ query and by using the default merge option.

System_CAPS_pubmethodLoadProperty<TEntity>(TEntity, Expression<Func<TEntity, Object>>, MergeOption)

Explicitly loads an object that is related to the supplied object by the specified LINQ query and by using the specified merge option.


ObjectContext.LoadProperty Method (Object, String)

Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option.

public virtual void LoadProperty(
	object entity,
	string navigationProperty
)

Parameters

entity
Type: System.Object

The entity for which related objects are to be loaded.

navigationProperty
Type: System.String

The name of the navigation property that returns the related objects to be loaded.

Exception Condition
InvalidOperationException

The entity is in a Detached, F:System.Data.Entity.EntityState.Added, or Deleted state or the entity is attached to another instance of ObjectContext .


ObjectContext.LoadProperty Method (Object, String, MergeOption)

Explicitly loads an object that is related to the supplied object by the specified navigation property and using the specified merge option.

public virtual void LoadProperty(
	object entity,
	string navigationProperty,
	MergeOption mergeOption
)

Parameters

entity
Type: System.Object

The entity for which related objects are to be loaded.

navigationProperty
Type: System.String

The name of the navigation property that returns the related objects to be loaded.

mergeOption
Type: System.Data.Entity.Core.Objects.MergeOption

The MergeOption value to use when you load the related objects.

Exception Condition
InvalidOperationException

The entity is in a Detached, F:System.Data.Entity.EntityState.Added, or Deleted state or the entity is attached to another instance of ObjectContext .


ObjectContext.LoadProperty<TEntity> Method (TEntity, Expression<Func<TEntity, Object>>)

Explicitly loads an object that is related to the supplied object by the specified LINQ query and by using the default merge option.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public virtual void LoadProperty<TEntity>(
	TEntity entity,
	Expression<Func<TEntity, object>> selector
)

Parameters

entity
Type: TEntity

The source object for which related objects are to be loaded.

selector
Type: System.Linq.Expressions.Expression<Func<TEntity, Object>>

A LINQ expression that defines the related objects to be loaded.

Type Parameters

TEntity

The type of the entity.

Exception Condition
ArgumentException

selector does not supply a valid input parameter.

ArgumentNullException

selector is null.

InvalidOperationException

The entity is in a Detached, F:System.Data.Entity.EntityState.Added, or Deleted state or the entity is attached to another instance of ObjectContext .


ObjectContext.LoadProperty<TEntity> Method (TEntity, Expression<Func<TEntity, Object>>, MergeOption)

Explicitly loads an object that is related to the supplied object by the specified LINQ query and by using the specified merge option.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public virtual void LoadProperty<TEntity>(
	TEntity entity,
	Expression<Func<TEntity, object>> selector,
	MergeOption mergeOption
)

Parameters

entity
Type: TEntity

The source object for which related objects are to be loaded.

selector
Type: System.Linq.Expressions.Expression<Func<TEntity, Object>>

A LINQ expression that defines the related objects to be loaded.

mergeOption
Type: System.Data.Entity.Core.Objects.MergeOption

The MergeOption value to use when you load the related objects.

Type Parameters

TEntity

The type of the entity.

Exception Condition
ArgumentException

selector does not supply a valid input parameter.

ArgumentNullException

selector is null.

InvalidOperationException

The entity is in a Detached, F:System.Data.Entity.EntityState.Added, or Deleted state or the entity is attached to another instance of ObjectContext .