Submit Changes() above, LINQ to SQL will dynamically construct and execute a SQL "UPDATE" statement that will update the two product property values we modified above.
In addition to updating existing rows in the database, LINQ to SQL obviously also enables you to insert and delete data.
You can accomplish this by adding/removing data objects from the Data Context's table collections, and by then calling the Submit Changes() method.
Over the last few weeks I've been writing a series of blog posts that cover LINQ to SQL.
LINQ to SQL is a built-in O/RM (object relational mapper) that ships in the .
Each instance of a class entity represents a row within the database table.
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.
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.
Note that if a Product's property values weren't changed by the property assignments above, then the object would not be considered changed and LINQ to SQL would therefore not execute an update for that product back to the database.
What makes O/R mappers like LINQ to SQL extremely flexible is that they enable us to easily model cross-table relationships across our data model.