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

Adult minds might alternate with Microsoft in the UK this is one of a number of short videos about a new technology that is coming with visual studio covering augers August will be the next version of visual studio that follows on from 2005 and the new technology but ultimately it is language integrated query or link to sequel and what that really is 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 in our status as one of a number of sessions or duality and perhaps introductory sessions and so on it might be worth going checking some other 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

In the 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 where I got here in the session is a simple console application is very similar to applications reviews 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 north and database and we ve also got a single profile which finances created acre complex in annals and a space 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 this 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 that will send that record into the database if you wanted a great another new customers who has Siegel s new customer again thrust I V demo why company know the cause why company and we can walk back to the customer s table and hand that other new customer Ltd context submit changes every wanted to bobble some of this 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 on the to version 2 0 the 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 at the end of the I would normally would do is we cannot service complete essentially wrapping the transaction around these operations is a voluntary article double queries from the complex inside the bands that transaction scope and they will also then be included as part of the transactional work so we can be that that will 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 we can you transaction scope switches 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 re writing this ago will already have a transaction from say a deal partner Andy to begin another scope like this in life is what you can do as total and utter much scope is reformatted code in is what you can do that imagine that we get an IDV transaction from somewhere is 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 contact and set its transaction to equal the transaction we got from blogger code with his minister that scope analysis the river icing on the lack of who do the right thing for us so we really get those two choices you can use a transaction scope and wrap it around the various interactions are you performing on context it have got to realise you can always walk up to the context and find a transaction after you set it or you can leave the

Minute 5

At excuses on transaction laboratories submit changes and it is a and operation of those 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 the 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 to 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 that complex now where can you go to more regional men there are enter up one and a yen you are over their arms green it will provide you information on the project including an equal weblog ad link in action net and encourage it go have a look about you like reading our and blocks and finally if you aren t providing feedback on a specific and join the fashion feel free to mail me on my e mail that it is there on screen three can 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: