Google Search

Google
 

Monday, July 21, 2008

Video: Transactions in LINQ to SQL

Presenter:Mike Taulty

In this video we'll talk about how we can use transactions when we are working with LINQ to SQL.

The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video


Minute 0

How minds might hold him in Microsoft and UK this is one of a number of short videos about a new technology that is coming with visual studio covering augers or as will be the next version of visual studio that follows on from 2005 and the new technology would ultimately it is language integrated query or link to sequel and what that really it is the new language integrated query pattern that crops up in various places in visual studio augers product off and you don t access API that provides object relational mapping that allows you to pull records from the database tables straight into memory as objects now as it is one of a number of sessions or duality and perhaps introductory sessions are on a magnifying checking summer that before you jump into the middle of the session here it is my stake are literally a couple of minutes talking about how you can wrap transactions around the work that you re doing smooth with link to sequel

Minute 1

Day in a session I m working with the March technology preview of visual studio covering augers which was the latest publicly available build at the time of recording video were not hearing the session is a simple console application is very similar to applications reduced in other sessions into that simple application with a link to single diagram it only has the custom entity on it right now from the Northern database and revolt of a single profile which ran out is created acre complex in Northern database and then doesn t do anything else this year in terms of transactions at France ago that we can play with will create a new customer got one of those was that the customer ID in fact it is that the customer ID to be and I m them oh ex and forgotten yourself to set the company name to the ex company for instance that I should before is run to got this new customer

Minute 2

ads that marks as a new record and a recall context of submit changes and apples and that record into the database if you wanted a great another new customers who has Segal s new customer again customer I see them why company name because my company and we can walk back to the customer s table and hand that other new customer and then we can do context submit changes everyone s into bundles and others work within the bounds of a single transaction everyone is to insert to be part of a single transaction and what we can do is what we expected it would standard on programming will be at aversion to buy a little framework with the new system transactions so they want the stuff to the transaction we can wrap a transaction scope around it you can create nothing however you want to create a with them

Minute 3

Different levels of isolation and so on Libya and discover I would normally would do it we cannot service complete essentially wrapping a transaction around these operations are voluntary articles or queries from the complex inside the bands that transaction scope and they will also then be included as part of the transactional work that we can do that that ll build and do the right thing on to say that if you didn t have a transaction scope around these two calls to submit changes then each one of the calls to submit changes would can create its own implicit transaction for the work that it was doing so if if we didn t have the scope to what you get is transaction one transaction to because we have the scope with using one transaction for the whole and other countries seem on the other there on the screen weeping is transaction scope switches will be what you d expect to see from the front through and on the data context will pick that up

Minute 4

The alternative might be that you are writing a piece ago will already have a transaction from say a field on their Andy to begin another scope like this in life is what you can do as little after much scope is reformatted code in is what you can do that imagine that we get an IDV transaction from somewhere and just one result thatfor a minor transaction millilitres milk as I don t have anywhere to get it from but imagine you did then what we can do is go to the contacts and set its transaction to equal the transaction we got an improbable that Coe was his minister that scope analysis and I likely on the lack of who do the right thing for us so we really get those two choices you can use transactions around the various interactions are you performing on context it about to realise you can was woke up to the context and find a transaction after you set it or you can leave the

Minute 5

At excuses on transaction might resubmit changes to the other that you are operational as operations or you can use a transaction scope and wrap it round the operations that you want to read also three choices but the content workout really run in a transaction scope or bring your own by setting a transaction property on the concept just a quick summary on what is a very short video when we re dealing with transactions under data context we can either call context submit changes and data context will credit on transaction of the operations it s performing in order to do your inserts updated the leads Wigan rapid transaction scope around the data context operations and we want included in that transaction and that would also include the queries that we are performing to the database so she wanted to do is serialise or work for instance you could wrap a transaction scope around all the operations he wanted to be serialise all or if you want is transaction took you worried

Minute 6

A database transaction from somewhere out in the context class has a transaction property that you can set on it which again is going to mean that when performing operations they will fall within the bounds of that transaction that you have explicitly set on the edge contacts now where can you go to more regional men there are enter a one and a yen URL of their on screen will provide you information on the project including an equal weblog a link in action net and encourage it go have a look about you like reading our third blocks and finally if you aren t providing feedback on a specific enjoying the fashion feel free to mail me on my e mail that it is their on screen food mail me plan and on fashion other than that and Ltd they could have listen and help to catch again in the future

Click here to go to original video page

No comments: