• 0
Phoenix Programmer

Dot Net Code Elixir Number 0007

سؤال

 What is TransactionScope object in Microsoft Dot Net Programming Code?

     TransactionScope is an object which queues all SQL transactions inside its block and add them to the database distributed transactions. Its main benefit with handling multiple transactions automatically is to allow one call code to commit all transactions or one call code to rollback all transactions.

     Its main disadvantage is combining all its block transactions within distributed transactions in the database, and if more than one connection pool is used, then all these pools are blocked in the database until the whole queued transactions are processed. The wrong usage of this object makes the database as a simple file to save data where in simple file case, it is impossible to have multithreaded operations. These multithreaded operations are the main reason for inventing databases. This wrong usage leads to too much timeout exceptions and transactions dead lock most of the time that results in a very slow heavy loaded system.

     In the TransactionScope block, you cannot prevent select database calls from not being included in the transaction which leads to a very big transaction logs, memory and very heavy recovery data in case transaction is rolled back for any reason.

     The best usage is to use only one connection pool through the whole TransactionScope process. The main need of this object is in case you have database calls that you cannot modify and you need to combine them with your code. So, it gives a great help in rollback for database transactions that you cannot modify or change.

     It is recommended to use pool and separated transactions within the database connection object which needs much more logic codes in transactions for commit and rollback well. This leads to very fast light transactions, makes SQL transactions able to be applied to none selectcommand calls to the database easily, and keeps the multithreaded ability active, in which the databases were invented in the first manner.

TransactionScope Example:

untitled

Good Transaction Example:

untitlegfhd

 

Code Elixir Notes By Mohamed Sobeh:
Dot Net Code Elixir Number 0007: https://goo.gl/jbQqqF
Draft 0007 Dot Net Code Elixir E-Book: https://goo.gl/HrygWP

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه

1 إجابات على هذا السؤال .

  • 0

thank you

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان

  • يستعرض القسم حالياً   0 members

    لا يوجد أعضاء مسجلين يشاهدون هذه الصفحة .