Video Tutorial Library:

LINQ to SQL 101 :

LINQtoSQL101_04_07 - Reviewing the ChangeList for a Transaction

Tags:

In this video, we'll look at how the DataContext keeps track of all the items that will be inserted, updated or deleted when you call SubmitChanges, and we'll do it by calling the DataContext.GetChangeList method.   Then we'll take it one step further and intervene in the SubmitChanges process to determine whether or not a given business rule is not met on the items that are about the be inserted, updated or deleted.  Why would we want to do that?

There are times when adding validation logic can't be done purely by looking at individual insert, upate or delete operations - and instead you want to be able to look at th entire change list of operations that are occurring for a transaction. 

By overriding the SubmitChanges method, we get a chance to make sure that, for example, you can't save a SalesOrderHeader that doesn't have any related SalesOrderDetail entities associated with it.  That's a pretty advanced scenario, but it's entirely possible.

Downloads:

Sign up today to access downloads.
LINQtoSQL101_04_07 - Reviewing the ChangeList for a Transaction
Duration: 16 Minutes, 25 Seconds
Size: 23.91M
Recorded Using: Visual Studio 2008 (all versions)

Get Free Videos via Email

Sign up for our newsletter and receive links to free videos and more.

Subscribe

We don't rent/sell/or commit other evil deeds with your email address. See our Privacy Policy.