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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:03:45+00:00 2026-05-23T03:03:45+00:00

In my current application in payment gateway, I want to perform this steps Transfer

  • 0

In my current application in payment gateway, I want to perform this steps

  1. Transfer fund from paypal .
  2. Save the payment record in database
  3. Increase the user’s fund(which is in our database) by the amount he transferred.

I am performing all this steps in app layer. Inside transaction scope

Below is the code

 public void DepositFundInAdvertiser(PaymentInfo paymentInfo, RegistrationID advertiserRegistrationID)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                PaymentResult paymentResult = paymentService.DepositFund(paymentInfo);

                Advertiser advertiser = advertiserRepository.Find(advertiserRegistrationID);
                TransactionNumber transactionNumber = paymentRepository.NextTransactionNumber();
                Payment payment = PaymentFactory.NewPayment(advertiser.Person, transactionNumber, paymentInfo, paymentResult);

                paymentRepository.Save(payment);

                AdvertiserBalance newBalance = new AdvertiserBalance(advertiser.Balance.Amount + paymentInfo.PaymentTotal);//Increasing advertiser fund

                advertiser.AddFund(newBalance);

                advertiserRepository.Save(advertiser);

                scope.Complete();


            }

        }

Problem : My question is can i use Transactionscope in app layer like this, because all this operation should be atomic ?

  • 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-23T03:03:46+00:00Added an answer on May 23, 2026 at 3:03 am

    I would say it’s a good compromise between complexity and robustness. You only have to keep in mind that by doing this you couple both repositories. You won’t be able to change either one without considering the effect of this change to the other one and to transaction infrastructure. As long as both repositories use the same database instance or RDBMS that fully supports distributed transactions, everything is fine. Sort of.

    As you probably know, the pure solution is async messaging, but it introduces a lot of complexity. The thing is, the complexity connected with async messaging tends to be flat — it doesn’t grow as you add more repositories, more data stores etc. It pays off in the long run. If you have one such use case, I would go with the solution you proposed. As I said, it’s good compromise and making software is about good compromises.

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

Sidebar

Related Questions

We want to integrate webmail with our current application. At present I need to
Our current application uses a smart object style for working with the database. We
My current application running on 2GB memory Normal GC cycle. I want to increase
In my current application I have this little animation. It makes a full 360
I want to get Assemblies Friendly Names in Current Application Domain and hence I
I'm deserializing some XML from an old application into an object in my current
Can I store something in HttpContext.Current.Application[MyData] accessing that from javascript?
My current application is something like this: I have an application deployed on Apache
In my current application, I need to be able to do this type of
In my current application I want to implement ASP.Net localization with global resources. I

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.