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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:13:48+00:00 2026-06-13T02:13:48+00:00

I got a serviced component which looks something like this (not written by me):

  • 0

I got a serviced component which looks something like this (not written by me):

[Transaction(TransactionOption.Required, Isolation = TransactionIsolationLevel.Serializable, Timeout = 120), EventTrackingEnabled(true)]
public class SomeComponent : ServicedComponent
{
    public void DoSomething()
    {
        try
        {
            //some db operation
        }
        catch (Exception err)
        {
            ContextUtil.SetAbort();
            throw;
        }
}

Is the ContextUtil.SetAbort() really required? Won’t the exception abort the transaction when the component is left?

  • 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-13T02:13:49+00:00Added an answer on June 13, 2026 at 2:13 am

    Only if you want to manage the transaction manually.

    Your component will vote automatically to abort (in case any exception is raised), or commit, if you decorate your operation with the [AutoComplete] attribute in this way:

    [AutoComplete]
    public void DoSomething()
    

    EDIT:

    For more info about this attribute, see MSDN here:

    The transaction automatically calls SetComplete if the method call
    returns normally. If the method call throws an exception, the
    transaction is aborted.

    Anyway if you are (in the rare case) that really need to manage the transaction manually, is really important that you don’t leave your transactions in doubt. I’m missing in your code the ContextUtil.SetComplete(); that should be explicitly called.

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

Sidebar

Related Questions

I'm using Equinox and I've got an OSGI.BND file which looks like this Service-Component:
I've got win service, which I want introduce in all my products. So how
I've got WCF service which contains List with data from LibW.dll(my dll). In main
This question about Timers for windows services got me thinking: Say I have (and
We've got an Enterprise system which has many processes (EXEs, services, DCOM servers, COM+
I am working on a program which consists of two parts Service component will
I have written and maintained a lot of Nant/Msbuild files, and have got a
I need to add a third party component to one of our products (which
I am not an expert in PHP, still learning it. I'd like some hints
I've got a C# service that currently runs single-instance on a PC. I'd like

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.