Export (0) Print
Expand All

ObjectContext.LoadProperty Method

Explicitly loads a related object when you are using POCO custom data classes.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method 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.
Public method LoadProperty(Object, String) Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option.
Public method 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.
Public method 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.
Top

When using POCO custom data classes, related objects cannot be explicitly loaded like instances of entity types that are generated by the Entity Data Model tools. This is because the tools generate the navigation properties that return an EntityCollection<TEntity> or EntityReference<TEntity> of related objects when Load is called on a RelatedEnd. POCO entities can still be loaded by using lazy loading by setting the LazyLoadingEnabled property to true on the instance of ObjectContextOptions that is returned by the ObjectContext.ContextOptions property, or by using eager loading with the Include method on the ObjectQuery<T>.

Show:
© 2014 Microsoft