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

  • Home
  • SEARCH
  • 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 6641775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:51:02+00:00 2026-05-25T23:51:02+00:00

I have question about managing transaction in asp.net application. For example i have application

  • 0

I have question about managing transaction in asp.net application.

For example i have application for planning vacations.

Controller has form to approving vacations.

One user – click save and approve vacation —- employee which want vacation has – 1 day
second user – clik save and approve vacation and ?

//pseudocode

    public void ApproveVacation(int vacationId)
    {
        //pull vacationdata from db
        var vacation = _dbContext.Vacations.FirstOrDefault(x => x.Id == vacationId);
        if (vacation != null && vacation.State != approved) //
        {
            using (TransactionScope scope = new TransactionScope())
            {
                vacation.state = approved;
                vacation.Employee.Days = -1;
                _dbContext.saveChanges();
                scope.complete();
            }
        }
    }

And question is simple, is transaction enough for this scenario or I must use one of concurency technique?

Thanks

EDIT : Context is created one per request.

  • 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-25T23:51:02+00:00Added an answer on May 25, 2026 at 11:51 pm

    Transaction handles atomicity of the operation so if operation modifies multiple database records it will always result in consistent state where all records are correctly modified (if operation succeeds) or all changes are rolled back (if operation fails).

    Concurrency handles possible modification of the same record by multiple processes / users because both could load original version of the record but one could save it first so when the second process tries to save a record it can silently override previous changes.

    So what are you trying to handle in your code?

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

Sidebar

Related Questions

I have a question about precompiling ASP.NET web application projects from TeamCity. This is
I have a question about using streams in .NET to load files from disk.
I have a question about how to deploy WPF application into a PC without
I have a question about creating and managing events inside an ascx custom web
A niave beginners question about database design. I have an app managing some logger
I'm putting together my first MVC application and have a question about how to
I have a question about copy constructors/copying objects. I have a class that has
I have question about pointers in C. Each pointer has 4 bytes in memory
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have a question about best practices regarding how one should approach storing complex

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.