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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:23:32+00:00 2026-06-10T22:23:32+00:00

I have a Transaction table that contains a TranRefId (for grouping purchase & reversal

  • 0

I have a Transaction table that contains a TranRefId (for grouping purchase & reversal transactions together). The interface with the SQL database is using Entity Framework 4. I would like to be able to do 2 things…

  1. Explicitly specify a value for the TranRefId
  2. Auto-generate a value (whether by querying the MAX and incrementing or by some other means) when none is specified.

My concern, as this is a web application, is that there could will be multiple threads performing this action simultaneously. If I do Select Max(TranRefId) and increment the value, there is a strong chance that multiple transactions will end up with the same value (due to concurrency). Is there any solution within the Entity Framework to help with concurrency issues like this??

Also, TranRefId is only specific to the account. See sample data below…

Transaction Table (My apologies, don’t know how else to make a table on here…)

TranId__TranRefId__Account

1_________1________A
2
_________1________A
3
_________1________B
4
_________2________B
5
_________1________C

  • 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-10T22:23:34+00:00Added an answer on June 10, 2026 at 10:23 pm

    If you don’t have to have TranRefId column as an int you could make it a uniqueidentifier. Then you could generate a new Guid and set the value to that – knowing that it would always be unique.

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

Sidebar

Related Questions

Hypothetical example: I have an SQL table that contains a billion or so transactions:
I have the following transaction: SQL inserts a 1 new record into a table
I have a declarative table defined like this: class Transaction(Base): __tablename__ = transactions id
I have a table that contains sets of sequential datasets, like that: ID set_ID
I have a table of data for a particular stock that contains every single
I have a table of transactions for purchases. Each transaction has a timestamp and
Using SQL2k5, I have a staging table that contains columns that will populate numerous
I have a mysql table that contains IPAddress parts TABLE `EndPoints`( `EndPointId` BIGINT(19) UNSIGNED
I have a table that contains records that can become part of a bill.
I have a table which contains stock transactions: +------+----------------------+------------------+ | Item | Running Stock

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.