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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:09:15+00:00 2026-05-26T16:09:15+00:00

I have a number of methods that ultimately call my this._context.SubmitChanges method. Because all

  • 0

I have a number of methods that ultimately call my this._context.SubmitChanges method. Because all of my methods operate asynchronously, it’s possible in my app (albiet unlikely) that multiple methods might try and submit before another submitchanges is complete.

Now, I know I can use the IsSubmitting method to make sure I don’t try and call one submit while another is occurring. I’m just wondering which direction to go from here. I’m not sure it’s really necessary to to set up a queue, since multiple entities looking to submit changes will all get rolled up under a .SubmitChanges call.

I have a callback function on each of the submitchanges that I make. One option would be to throw a flag into my app that, in the callback, checks to see if the flag was set during the interim. If flag was set, it fires off another round. Seems hackish though. Is there a better way?

Thanks.

[Edit]

I don’t have as much EF fu as I’d want, but I think I’m keeping them separate, as outlined in the code below (my VM constructor)… when I’m looking to submit changes, it’s on each of these independent entityLists…

Here is an example call to submitchanges (where each call is using a different entitylist)

this._keywordSource.Add(new Keyword() { keyword = searchText });
if (this._context.Keywords.HasChanges && !this._context.IsSubmitting)
{
    this._context.SubmitChanges(KeywordsAddedCompleted, null);
}

Here is code from my viewmodel constructor:

this._gnipRuleSource = new EntityList<GnipRule>(this._context.GnipRules);
this._keywordSource = new EntityList<Keyword>(this._context.Keywords);
this._cachedSource = new EntityList<CachedKeywordResult>(this._context.CachedKeywordResults);
this._feedSourceSource = new EntityList<FeedSource>(this._context.FeedSources);

this._gnipRuleLoader = new DomainCollectionViewLoader<GnipRule>(LoadGnipRules, LoadGnipRulesCompleted);
this._keywordLoader = new DomainCollectionViewLoader<Keyword>(LoadKeywords, LoadKeywordsCompleted);
this._cachedLoader = new DomainCollectionViewLoader<CachedKeywordResult>(LoadCachedKeywords, LoadCachedKeywordsCompleted);
this._feedSourceLoader = new DomainCollectionViewLoader<FeedSource>(LoadFeedSources, LoadFeedSourcesCompleted);

this._gnipRuleView = new DomainCollectionView<GnipRule>(this._gnipRuleLoader, this._gnipRuleSource);
this._keywordView = new DomainCollectionView<Keyword>(this._keywordLoader, this._keywordSource);
this._cachedView = new DomainCollectionView<CachedKeywordResult>(this._cachedLoader, this._cachedSource);
this._feedSourceView = new DomainCollectionView<FeedSource>(this._feedSourceLoader, this._feedSourceSource);
  • 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-26T16:09:15+00:00Added an answer on May 26, 2026 at 4:09 pm

    I’m at the same place and I’m considering implementing a queue simply because I can then be sure that my operations are being committed reliably and in order. I’ve done a little bit of research and haven’t yet found a nice pattern to deal with this situation.

    Your callback pattern does seem like an easy workaround, though. Hacky in it’s lack of structure, but if you ensure all submits go through a single piece of code then it should be easy enough to implement and maintain. It would almost certainly be quicker to implement that a queueing pattern.

    Checking IsSubmitting and avoiding the SubmitChanges, to let the uncommitted change be rolled into the next submit that’s called (as you describe) works fine. Unfortunately it will eventually lead to some uncommitted changes (the last change in a user’s session wasn’t persisted because IsSubmitting was true at that time). It would be ‘bad luck’ when that happens especially as it’s unlikely that multiple submits will happen quickly, but it would be extremely annoying for users and testers who wouldn’t be able to replicate the bug.

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

Sidebar

Related Questions

I have a method connection(int n) which gives me all the cells number that
In one of my classes I have a number of methods that all draw
Ok so I have a number of methods that look like this:- which sorts
I have various sorting methods that are all sorting the same 100,000 random number
Say I want to have a method that takes any kind of number, is
I have and old(ish) C# method I wrote that takes a number and converts
I have a number of test classes and methods that copy a particular directory
For some of my unit tests I have to call methods that require a
I have a class that has a number of methods that follow the below
I have a number of data access methods that accept a dynamic object parameter

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.