ObjectContext.LoadProperty(Of TEntity) Method (TEntity, Expression(Of Func(Of 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.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
'Declaration Public Sub LoadProperty(Of TEntity) ( _ entity As TEntity, _ selector As Expression(Of Func(Of TEntity, Object)) _ )
The LoadProperty method must be called to achieve explicit loading when you are using POCO custom data classes.
After calling LoadProperty, the related object can be accessed through the navigation properties of the source entity.
The property to load is specified by a LINQ expression, which must be in the form of a simple property member access, as in (entity) => entity.PropertyName, where PropertyName is the navigation property that returns the related objects to be loaded. An exception will occur if other forms of the LINQ expression are used.
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(Of TEntity) or EntityReference(Of TEntity) of related objects when Load is called on a . 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(Of T).
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.