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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:54:26+00:00 2026-05-22T00:54:26+00:00

I have services been called through the ‘Guardian’ method, that has TransactionScope opened for

  • 0

I have services been called through the ‘Guardian’ method, that has TransactionScope opened for each request and complete that transaction if everything is fine:

void ExecuteWorker(...)
{
    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
    {
        ...CallLogicMethods...

        scope.Complete();
    }
}

One of the methods interacts with ‘External’ service, and in case if that interaction fails all my transaction fails also. As a result, I don’t save required data (been calculated before request to external service.

void DoLogic1(...)
{
    CalculateSomeData(...);
    SaveCalculatedData(...);

    DoRequestToExternalService(...);
}

What is the best way to resolve that issue?

Application is written using C#, .NET 4.0, MS SQL 2008.

Myself I see two solutions

  1. Using try/catch:

    void DoLogic11(…)
    {
    CalculateSomeData(…);
    SaveCalculatedData(…);

    try
    {
        DoRequestToExternalService(...);
    }
    catch(Exception exc)
    {
        LogError(...);
    }
    

    }

The lack of this approach is that I’m hiding exception from the caller. But I would like to pass error outside as an exception (to be logged, etc).

  1. Using ‘Nested transcation’, but I not sure how that works.

Here is my vision it should be:

void DoLogic12(...)
{
    using (TransactionScope scopeNested = new TransactionScope(TransactionScopeOption.Suppress))
    {
        CalculateSomeData(...);
        SaveCalculatedData(...);
        scopeNested.Complete()
    }

    DoRequestToExternalService(...);        
}

I’ve implemented that, tried to use, but it seems that nested transcation is committed only in case when external is committed also.

Please advise.

  • 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-22T00:54:27+00:00Added an answer on May 22, 2026 at 12:54 am

    I’ve decided to change my ‘ExecuteWorker’ method to create transaction conditionally. Therefore I’m able to create transaction in the ‘DoLogicX’ method itself.

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

Sidebar

Related Questions

I have been working on a BlackBerry application that consumes web services from ColdFusion
I'm messing with Android services, and I have found that ServiceConnection.onServiceConnected() gets called fairly
I have been working on a web services related project for about the last
I have been quite comfortable with windows-services, I have been practicing since from last
I have been tasked with designing my web services client code to use the
I have been working with WebServices for sometime. I dealt with many services where
I want to bounce an idea around. I have been building web services and
I have been getting into RIA services because I thought it would simplify dealing
I have an old school ASP (note: not ASP.NET) web site that has a
I have been trying to follow some WCF Data Services examples and have the

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.