How to: Directly Execute Commands Against the Data Source

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This topic shows how to directly execute commands against the data source using the following methods: ExecuteStoreCommand, ExecuteStoreQuery, and Translate. For more information, see Directly Executing Store Commands.

The examples in this topic use the School Model.


The following example shows how to pass parameters to the ExecuteStoreQuery method.

The following example creates a custom class named DepartmentInfo that has properties with the same names as the column names of the Department table. The example executes a command that inserts a row into the Department table. It then uses the ExecuteStoreQuery method to query for a Department and then returns the DepartmentInfo object. The code then executes a command that deletes the new row.

The following example returns a DbDataReader. It then translates the DbDataReader into objects of the Department type.

See Also