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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:00:23+00:00 2026-06-07T06:00:23+00:00

I am working on a small app to translate and import a large amount

  • 0

I am working on a small app to translate and import a large amount of data from one database to another. To do this, I’m using Entity Framework and some custom extensions to commit a page of items at a time, in batches of 1000 or so. Since this can take a while, I was also interested in making sure the whole thing wouldn’t grind to a halt if there is a hiccup in the connection while it’s running.

I chose the Transient Fault Handling Application block, part of Enterprise Library 5.0, following this article (see Case 2: Retry Policy With Transaction Scope). Here is an example of my implementation in the form of an ObjectContext extension, which simply adds objects to the context and tries to save them, using a Retry Policy focused on Sql Azure stuff:

public static void AddObjectsAndSave<T>(this ObjectContext context, IEnumerable<T> objects)
    where T : EntityObject
{
    if(!objects.Any())
        return;

    var policy = new RetryPolicy<SqlAzureTransientErrorDetectionStrategy>
        (10, TimeSpan.FromSeconds(10));
    var tso = new TransactionOptions();
    tso.IsolationLevel = IsolationLevel.ReadCommitted;

    var name = context.GetTableName<T>();

    foreach(var item in objects)
        context.AddObject(name, item);


    policy.ExecuteAction(() =>
    {
        using(TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso))
        {
            context.SaveChanges();

            ts.Complete();
        }
    });
}

The code works great, until I actually test the Retry Policy by pausing my local instance of Sql Server while it’s running. It almost immediately poops, which is odd. You can see that I’ve got the policy configured to try again in ten second intervals; either it is ignoring the interval or failing to catch the error. I suspect the latter, but I’m new to this so I don’t really know.

  • 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-07T06:00:24+00:00Added an answer on June 7, 2026 at 6:00 am

    I suspect that the SqlAzureTransientErrorDetectionStrategy does not include the error your are simulating. This policy implements specific errors thrown by SQL Azure. Look at this code to find out which errors are implemented by this policy: http://code.msdn.microsoft.com/Reliable-Retry-Aware-BCP-a5ae8e40/sourcecode?fileId=22213&pathId=1098196556

    To handle the error you are trying to catch, you could implement your own strategy by implementing the ITransientErrorDetectionStrategy interface.

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

Sidebar

Related Questions

I'm working on a small iphone app using Core Data, where I got a
I am working on a small app and am using jQuery Tools Tooltip (
I'm working a small qt app (using PyQt4) and I've come up with an
I'm working on a small iPhone app, and I am using NSUserDefaults as my
I am working on a small app that will need a database, I was
I'm working on a small app that uses sprites which are rendered using a
I am working on a small iPhone app using Titanium/Appcelerator. Now what I am
I have been working on a small web app using the Stripes framework. Now
I've been working on a small iPhone app that displays web content using the
I am working on a small app where I can import a list of

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.