Database Transactions inside Silverlight

2 posts, 0 answers
  1. Alon
    Alon avatar
    1 posts
    Member since:
    Jul 2010

    Posted 23 Aug 2010 Link to this post


    I am a beginner with Telerik ORM and I already used the quick start guide to create a simple silverlight application that fetches and updates database tables.

    I didn't find, though, how to create database transactions inside the silverlight control (begin, rollback, commit).

    Is there any code example for that?

  2. Serge
    Serge avatar
    375 posts

    Posted 24 Aug 2010 Link to this post

    Hi Alon,

    Let me shed some light on how you can handle transaction like actions using the client context in Silverlight. First of all the objects you retrieve from the context are disconnected from it. The usual scenario will be to get some objects, modify them a bit and then call the update method on the context. Finally call the SubmitChanges method that will do a service call and update the actual database.

    Here it is important to notice that the context will hold the changes you want to be persisted, it will work as a change set. If you want to rollback the changes you can easily create a new context that does not hold any changes. Or even use the old object with the new context, as they are disconnected it will work without problem.

    To wrap it up, there is no need for a 'begin transaction', as it would automatically begin. The SubmitChanges method stands for a commit and you can easily rollback the changes when you create a new context.

    I hope this helps. Please contact us back if you need further assistance.

    Kind regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top