EntityReference<TEntity>.CreateSourceQuery Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates an equivalent object query that returns the related object.

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

public ObjectQuery<TEntity> CreateSourceQuery()

Return Value

Type: System.Data.Objects.ObjectQuery<TEntity>

An ObjectQuery<T> that returns the related object.

Exception Condition
InvalidOperationException

When the object is in an Added state.

-or-

When the object is in a Detached state with a MergeOption other than NoTracking.

This method is used to obtain a new instance of ObjectQuery<T> that, when it is executed, returns the related object. This is useful as the starting point for a more complex join, union, or filtered query, or to return the referenced object in a detached state using the NoTracking option.

.NET Framework
Available since 3.5
Return to top
Show: