ObjectContext::LoadProperty Method
Explicitly loads a referenced entity or collection of entities into the given entity.
Assembly: EntityFramework (in EntityFramework.dll)
| Name | Description | |
|---|---|---|
![]() | LoadProperty(Object^, String^) | Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option. |
![]() | LoadProperty(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. |
![]() | LoadProperty<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. |
![]() | LoadProperty<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.
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.
public: generic<typename TEntity> [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] virtual void LoadProperty( 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.
public: generic<typename TEntity> [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] virtual void LoadProperty( 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 . |
