ObjectResult(Of T) Class
Represents the result of an ObjectQuery(Of T) as an enumerable collection of objects.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
This class implements IEnumerable(Of T) and IDisposable. Instances of this class are returned from the Execute method and from the GetEnumerator method.
The example in this topic is based on the Adventure Works Sales Model, which was generated by the Entity Data Model Wizard.
The following example returns an ObjectResult(Of T) from the Execute method. Then it gets an enumerator and iterates through the query results. At the end, it releases the enumerator and the ObjectResult(Of T) object.
Using advWorksContext As New AdventureWorksEntities Dim query As New ObjectQuery(Of Product)("Product", advWorksContext) ' Execute the query and get the ObjectQueryResult. Dim queryResult As ObjectResult(Of Product) = query.Execute(MergeOption.AppendOnly) ' Iterate through the collection of Product items. Dim result As Product For Each result In queryResult Console.WriteLine("{0}", result.Name) Next End Using
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.