Using transaction protection data in ADO.NET (2)

zhaozj2021-02-16  44

Profound analysis

The business is most basically included in two steps - start, then submit or roll back. Start calling defines the boundary of the transaction, and call submission or rollback in the definition. In the transaction boundary, all execution descriptions are considered to complete tasks Some of them must be one of success or failure. If everything is successfully submitted, all data modifications will be executed, if any error occurs, rollback will cancel the modification. All .NET data provides objects with similar classes. And methods to complete these operations.

Isolated grade

Isolated levels define transaction isolation behavior in the transaction. The higher the isolation level, the more data is not interfere with other business. Many databases enhance the isolated level by locking. You should check your target DBMS. Ok The practice is performance and concurrency, more locking systems will have to maintain, the more words are easy to cause conflicts and reduce speeds for different processing.

The following list is the Isolated Level Support for ADO.NET, from .NET Framewok SDK. The following list is getting stronger.

MEMBER NAME

Description

Value

Unspecified

Supported by the .NET Compact Framework.

A Different Isolation Level Than The One Specified Is Being Used, But The Level Cannot Be Determined.

-1

Chaos

Supported by the .NET Compact Framework.

The Pending Changes from Morely Isolated Transactions Cannot Be overwritten.

16

ReadunCommitted

Supported by the .NET Compact Framework.

A Dirty Read Is Possible, Meaning That No Shared Locks Are Issued and No Exclusive Locks Are Honored.

256

Readcommitted

Supported by the .NET Compact Framework.

SHARED LOCKS Are Held While The Data IS Being Read To Avoid Dirty Reads, But The Data Can Be Changed Before The end of the transaction, resulting in non-review

4096

REPEATABLEREAD

Supported by the .NET Compact Framework.

.

65536

Serializable

Supported by the .NET Compact Framework.

A Range Lock Is Placed on The Data Set, Preventing Other Users from Updating or Inserting Rows Into The Dataset Until The Transaction Is Complete.

1048576

Small Note: Disorderless Isolated Level is not supported by SQL Server or Oracle, only OLEDB data provides the object to set transactions as an isolated level. If you try to use SQL Server or Oracle to set it, you will get an argumentException, indicate Invalid isolation level parameters.

SQL Server and Oracle and OLE DB Data Provide Objects Deadcommitted Isolated Level. ODBC Data Provides Object The default isolation level is different, depending on the Difference of the ODBC. If you consider readcommitted is not the isolated level you want, you can use Transaction.issionLevel attribute to specify different levels. You should carefully consider modifying these settings, although appropriate tests are performed, these changes cannot affect data consistency, or other concurrency issues. If there is a database administrator, you should ask them about the right level of specific tasks. You should also check how your database is handled in your database how to handle isolated levels and locks. Local rollback is usually in the case, if a transaction has an error, you will find that you want to roll back is not the entire transaction. You want to do this only when you have a lot of time you need to handle some transaction. However, the inspection section will have a lot of overhead. You want to balance the data to modify costs and have to roll some small parts to avoid excessive expenses.

Partial rollback usually uses SavePoints or embedded transactions, mainly on how your database works. Some DBMS or do not provide this mechanism, so view your database documentation to see whether or how to implement local rollback.

SQL Server

with

Oracle

with permission

SavePoints

(You can quote when you cause a rollback) to stop rolling back in a predetermined point. They don't really perform embedded transactions, and some of the DBMSS is completed the same job. SQL

Server

In the simplest sense, you can use embedded transactions, you can use embedded starts. . . Submit the T-SQL block statement. However, only all transactions are submitted other than the submission process, just consume system variables, so you can track how much transactions you have opened.

Some databases have implemented real embedded transactions. For these data types, embedded submission will actually submit a responsive transaction, even if the external transaction rollback embedded transaction is still submitted.

转载请注明原文地址:https://www.9cbs.com/read-26487.html

New Post(0)