NET Framework component that adds native data querying capabilities to . In other words LINQ has the power of querying on any source of data (Collection of objects, database tables or XML Files).We can easily retrieve data from any object that implements the IEnumerable LINQ to SQL translates our actions to SQL and submits the changes to the database.
LINQ to SQL is a built-in O/RM (object relational mapper) that ships in the .
NET Framework 3.5 release, and which enables you to easily model relational databases using . You can use LINQ expressions to query the database with them, as well as update/insert/delete data.
I could then write the below code to loop over unpopular, expensive products and set the "Reorder Level" property of them to zero: When I call northwind.
Submit Changes() above, LINQ to SQL will calculate and execute an appropriate set of UPDATE statements to modify the products who had their Reorder Level property changed.
When we perform queries and retrieve objects like the product instances above, LINQ to SQL will by default keep track of any changes or updates we later make to these objects.
We can make any number of queries and changes we want using a LINQ to SQL Data Context, and these changes will all be tracked together.After clicking the Add button the Context Data file is created.Now we should drag all the tables onto the left-hand side of the designer and save (as shown in the following figure).The SELECT Operation Conculsion To perform select, insert, update and delete operations we create a table and create a data context class; in other words a dbml file.In this file designer view we drag and drop the COURSE table from the Server Explorer.When we defined our data model, the LINQ to SQL designer also created a custom Data Context class that provides the main conduit by which we'll query our database and apply updates/changes.