Introduction
Whenever someone asks me about the DataContext I always refer to it as the “brains” of Linq to SQL, why? Because it is. It is responsible for the translation of Linq to T-SQL, and the mapping of the results (rows) of that query to objects, and so much more.
If you run any codegen tool (SqlMetal, or Linq to SQL file (VS Orcas designer)) you always get a class that derives from the DataContext class. The DataContext can be equated to a database, in that it contains a series of tables (normally this is implemented as a property that returns a Table), and sprocs (methods calls that invoke underlying sprocs at the DB layer).
Note: The DataContext can also handle other SQL Server features like views, and table functions etc.
What’s so special about the DataContext class?
Most notably the DataContext takes some Linq code and generates the appropriate T-SQL statement for that query; if that query returns rows then the DataContext object will take care of mapping those rows to objects.
Read More at hurricanesoftwares.com in .net Category
I think more people would find your threads if they were in the C# Tutorial forum, but this is some good stuff to know. I've not yet delved into LINQ throughout my C# advances, but the time will come.
-Martin
Thanks, how can i post this is C# Tutorial now.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks