Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 539131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:06:16+00:00 2026-05-13T10:06:16+00:00

First of all, this will not be a post about Database Transactions. I want

  • 0

First of all, this will not be a post about Database Transactions. I want to know more about the TransactionModel in .NET 2.0 and higher. Since I am developing against .NET 3.5 newer models are apprechiated.

Now, what I would like to acheive is something like the following

    public void Withdraw(double amount)
    {
        using (TransactionScope scope = new TransactionScope())
        {
            Money -= amount;

            if (Money > 0)
                scope.Complete();
        }
    }

Which would mean that when the Money is less than 0, everything inside the TransactionScope should be RolledBack, however, it’s not.

A simple test as followed

        ImportantObject obj = new ImportantObject(1);

        Console.WriteLine(obj.Money);

        obj.Withdraw(101);

        Console.WriteLine(obj.Money);

Provided that the Stadard Money amount is 100.

Did I miss something here or is this not how the transactions should work? And what are the performance losses using this model?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:06:16+00:00Added an answer on May 13, 2026 at 10:06 am

    You may want to read Volatile Resource Managers in .NET: Bring Transactions to the Common Type by Juval Lowy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all there is a partial question regarding this, but it is not
First of all, let's define a few tables: Users table will store information about
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built
Basically, something better than this: <input type=file name=myfile size=50> First of all, the browse
Greetings to all! This is my first question here on stackoverflow. I have a
First of all, I know how to build a Java application. But I have
First of all: I am not an experienced ClearCase user, but I have lots
This is my first post to stackoverflow, so bear with me. :) I am
So, I have been trying to fix this for about two months. It all
First of all, I don't need a textual comparison so Beyond Compare doesn't do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.