ObjectContext::CreateQuery<T> Method (String^, array<ObjectParameter^>^)
.NET Framework (current version)
Creates an ObjectQuery<T> in the current object context by using the specified query string.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
public: generic<typename T> ObjectQuery<T>^ CreateQuery( String^ queryString, ... array<ObjectParameter^>^ parameters )
Parameters
- queryString
-
Type:
System::String^
The query string to be executed.
- parameters
-
Type:
array<System.Data.Objects::ObjectParameter^>^
Parameters to pass to the query.
Type Parameters
- T
The entity type of the returned ObjectQuery<T>.
| Exception | Condition |
|---|---|
| ArgumentNullException | The queryString or parameters parameter is null. |
Use CreateQuery<T> to create an ObjectQuery<T> of the specified type that belongs to the current object context.
This example is based on the AdventureWorks Sales Model.
The example creates a simple query and iterates through the collection of results.
.NET Framework
Available since 3.5
Available since 3.5
Show: