May 2010
Intermediate to advanced
1272 pages
61h 18m
English
LINQ to SQL also allows writing SQL code against entities so that you can still take advantage of the object model if you prefer the old-fashioned way of manipulating data. The DataContext class offers an instance method named ExecuteQuery(Of T) that allows sending SQL instructions in string form. For example, the following code retrieves a list of products for the Grain/Cereals category, ordered by product name:

ExecuteQuery(Of T) returns an IEnumerable(Of T) that you can then treat as you like, according to LINQ specifications. You can also send SQL instructions directly to the database invoking the ExecuteCommand ...
Read now
Unlock full access