IRGDataContext Methods |
The IRGDataContext type exposes the following members.
Name | Description | |
---|---|---|
AddObjectTEntity |
Adds an object to the object context.
| |
CreateQuery |
Creates an IQueryableT in the current object context by using the specified query string.
| |
DeleteObjectTEntity |
Marks an object for deletion.
| |
ExecuteStoreCommand |
Executes an arbitrary command directly against the data source using the existing connection.
The command is specified using the server's native query language, such as SQL.
As with any API that accepts SQL it is important to parameterize any user input to protect against a SQL injection attack. You can include parameter place holders in the SQL query string and then supply parameter values as additional arguments. Any parameter values you supply will automatically be converted to a DbParameter.
context.ExecuteStoreCommand("UPDATE dbo.Posts SET Rating = 5 WHERE Author = @p0", userSuppliedAuthor);
Alternatively, you can also construct a DbParameter and supply it to SqlQuery. This allows you to use named parameters in the SQL query string.
context.ExecuteStoreCommand("UPDATE dbo.Posts SET Rating = 5 WHERE Author = @author", new SqlParameter("@author", userSuppliedAuthor));
| |
ExecuteStoreCommandAsync |
Asynchronously executes an arbitrary command directly against the data source using the existing connection.
The command is specified using the server's native query language, such as SQL.
As with any API that accepts SQL it is important to parameterize any user input to protect against a SQL injection attack. You can include parameter place holders in the SQL query string and then supply parameter values as additional arguments. Any parameter values you supply will automatically be converted to a DbParameter.
context.ExecuteStoreCommandAsync("UPDATE dbo.Posts SET Rating = 5 WHERE Author = @p0", userSuppliedAuthor);
Alternatively, you can also construct a DbParameter and supply it to SqlQuery. This allows you to use named parameters in the SQL query string.
context.ExecuteStoreCommandAsync("UPDATE dbo.Posts SET Rating = 5 WHERE Author = @author", new SqlParameter("@author", userSuppliedAuthor));
| |
ExecuteStoreQueryTElement | Obsolete.
Executes a query directly against the data source and returns a sequence of typed results.
The query is specified using the server's native query language, such as SQL.
Results are not tracked by the context, use the overload that specifies an entity set name to track results.
As with any API that accepts SQL it is important to parameterize any user input to protect against a SQL injection attack. You can include parameter place holders in the SQL query string and then supply parameter values as additional arguments. Any parameter values you supply will automatically be converted to a DbParameter.
context.ExecuteStoreQuery<Post>("SELECT * FROM dbo.Posts WHERE Author = @p0", userSuppliedAuthor);
Alternatively, you can also construct a DbParameter and supply it to SqlQuery. This allows you to use named parameters in the SQL query string.
context.ExecuteStoreQuery<Post>("SELECT * FROM dbo.Posts WHERE Author = @author", new SqlParameter("@author", userSuppliedAuthor));
| |
GetObjectByKeyTEntity |
Returns an object that has the specified entity key.
| |
SaveChanges |
Saves all changes made in this context to the underlying database.
| |
SelectTEntity |
Projects each element of a sequence into a new form.
| |
SelectValueTResultType |
Limits the query results to only the property specified in the projection.
|