This is a migrated thread and some comments may be shown as answers.

Transactions

1 Answer 70 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 2
Erik asked on 14 Jul 2011, 10:00 AM
Hi,

maybe a double post, but regarding Open Access I'm always asking myself if I'm reading a post or a blog on the old or the new way... the doc and blogs are not dated so that makes it that much harder...

I'm having some general questions regarding Open Access, latest version Q2 2011. I'll post them separately.

Q:how do I handle transactions? I se some examples using a scopeprovider, but I thought this was the old way, I'm using a context. but my context and scope give me an error saying that I can't start a transaction because the connnection is "managed".

regards,

Erik

1 Answer, 1 is accepted

Sort by
0
Accepted
Kosta Hristov
Telerik team
answered on 18 Jul 2011, 07:42 PM
Hello Erik,

You are right, the old approach - with an object scope provider, requires the transactions to be handled manually. However, with the introduction of the new API, this is no longer needed. When you create a domain context, a new transaction starts automatically. To commit the transaction, simply call context.SaveChanges(). This will save your changes and start a new transaction. If you want to revert the changes, call DataContext.ClearChanges() instead.
I hope this answers your question. Please do not hesitate to contact us if you need more help.

Kind regards,
Kosta
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Development (API, general questions)
Asked by
Erik
Top achievements
Rank 2
Answers by
Kosta Hristov
Telerik team
Share this question
or