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 9167573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:25:26+00:00 2026-06-17T15:25:26+00:00

I have the following case, using C# and .NET 4.0. I need to control

  • 0

I have the following case, using C# and .NET 4.0.

I need to control that when I load a group of registers, other user can’t add a new one to this group until the first user has not finished to work with this data. This is because when one user adds a new register its data depend on the information of the all the registers of the same group.

One simple example (silly example, the real case is a bit more complex). I have a group that are int numbers. I want to have a field in my Data register that point to the max int of the group.

Group: (IDGRoup, Name, description...)

Data: (IDData, IDGroup, IDMaxData,...)

If I have two users that try to add a new int to the group, the process would be the following:

1.- load all the number from the group.

2.- Search for the max number

3.- set the IDMaxData with the ID of the max numer.

4.- Save the iformation.

The problem is that if two users load at the same time, and try to add a new int, if one of them will add the new max number of the group, the other user can’t set the correct ID to the max number, because he does not load the new max number. So the information is not coherent, because the this user set the IDMaxData to the old max number.

How to ensure that the data is coherent?

I am cosiderating to use a transaction.

1.- Load the register from Group which ID is the ID of the group that I want. If I use a transaction, with an isolation level serializable, in the moment that I load the register of the group, the second user is block because he can’t load the register. So if the second user can’t load the register of the group table, he will not can to add a new register.

2.- The first register can load all the int from Data table. He can be sure that there are all the registers because the second user can’t add a new register (he is waiting), so he can set the IDMaxData with the warranty that is the correct number.

3.- save and release the data.

The second user, that he was wating, no can load the register from Group table, and block to other users. Do the work and release the registers.

My doubt is if this is a good solution. The only problem that I can see is that I block the register of the Group table, so if someone want to update its information, must wait until the register is release. But this is a minor problem, because the information of this table will not be upadate.

There is other alternatives?

Thanks.

  • 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-06-17T15:25:27+00:00Added an answer on June 17, 2026 at 3:25 pm

    you are describing the technique of strict phase lock in which no transaction is allowed to begin untill the last trxn is committed. But we have other techniques also. Use simple phase lock.

    before any write the trxn must perform the read.
    the trxn must acquire the read or write lock before performing any change on data item.
    no two trxn can take write lock on same item. 
    

    you can also use timestamp ordering(TO) technique.

    For more info take a look at this ppt -> Concurrency contol

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

Sidebar

Related Questions

I have the following use case: There's a class called Template and with that
Problem Description: I am using ASP.NET MVC and I have the following method in
I have the following string: 0000015700 I need an algorithm that does the following:
Assume that you have this code in C#/.NET (using PostgreSQL via ODBC): using System.Data.Odbc;
In a C#/ASP.NET application, I have a form that renders much like the following
I'm using agsXMPP in my .NET project (WinForms) I have the following Code block,
I have following use-case: there are several assemblies decorated with ProtoContract classes and I
I have the following case: Edited: removed link In IE7 gives me different view
I have the following case: All boats have a boat type like shark ,
I have the following case where I want to accept the following routs '/type/view/23'

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.