Implement transaction and rollback for multiple Procedure from .net.core 6 c# application

Binumon George 161 Reputation points

HI All,

     I am giving Below my API Model structure 

  public int organizationNPI { get; set; }
        public string  organizationName { get; set; }
        public string organizationTIN { get; set; }
        public string website { get; set; }
        public IEnumerable<Location> ?location { get; set; }
        public IEnumerable<Contact>? contact { get; set; }
        public IEnumerable<Specialities> ?specialities { get; set; }
        public IEnumerable<Languages>? languages { get; set; }

As you seeing in model There is some Basic Information and some additional information in List. So i am using different Procedure for inserting  these data. Here my question is  if  fail one of the procedure i want to roll back entire transaction from entire procedure. These procedure calling from DAL file. So How implement transaction this situation from c#
A set of technologies in the .NET Framework for building web applications and XML web services.
2,551 questions
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
147 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce ( 28,036 Reputation points

    it will depend on which library you will use. .net 6 does not support the distributed transaction manager, so you should use the same connection, (or join the transaction if supported) and use begin tran / commit tran commands.

    No comments