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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:57:21+00:00 2026-05-13T15:57:21+00:00

Over the weekend I realized that an application I’m working on which uses NHibernate

  • 0

Over the weekend I realized that an application I’m working on which uses NHibernate as an ORM to a sqlite database has a concurrency issue.

I’m essentially looping through a collection in javascript and executing the following:

var item = new Item();
item.id = 1;
item.name = 2;
$.post("Item/Save", $.toJSON(item), function(data, testStatus) {
  /*User can be notified that the item was saved successfully*/
}, "text");

And my server code looks like this:

public ActionResult Save()
{
    string json = Request.Form[0];
    var serializer = new DataContractJsonSerializer(typeof(JsonItem));
    var memoryStream = new MemoryStream(Encoding.Unicode.GetBytes(json));
    JsonItem item = (JsonItem)serializer.ReadObject(memoryStream);
    memoryStream.Close();

    SaveItem(item);
    return Content("success");
}

The concurrency issue obviously occurs in the loop calling Save() for each element iterated, but I’m not sure how to accommodate for and prevent this. Any advice is appreciated.

  • 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-13T15:57:22+00:00Added an answer on May 13, 2026 at 3:57 pm

    What is the concurrency issue?

    I didn’t understand your problem with concurrency.

    Comment: if you iterate the collection, AND in the postback you reload the window… hmmm… there is a potential problem here. The first postback will throw away any pending work, refreshing completely the page.

    Suggestion: don’t iterate, send the complete collection in one Ajax call.

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

Sidebar

Related Questions

The hosting company that my employer uses upgraded to Exchange 2010 over the weekend.
Let's say at your job your boss says, That system over there, which has
Over the weekend, for some reason, one of our servers has decided to start
I ran into a strange issue over the weekend while I was working on
I have taken over support of a VB .Net application that makes use of
I was working a bit with preg_replace over the weekend and I was reading
I recently found out over the weekend that iframes are not valid in XHTML
I've run into a problem. Over the weekend I've been working on a project
We're using sessions in our GAE/J application. Over the weekend, we had a large
It seems that over the weekend, the following Delegate method - (void)OAuthTwitterController:(SA_OAuthTwitterController *)controller authenticatedWithUsername:(NSString

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.