Tutorials to .com

Tutorials to .com » Dotnet » Database » The use of the ADO.NET Data Service to protect the integrity of (3)

The use of the ADO.NET Data Service to protect the integrity of (3)

Print View , by: iSee ,Total views: 10 ,Word Count: 977 ,Date: Mon, 8 Jun 2009 Time: 12:25 PM

Affairs in ADO.Net

Transaction model supports two Ado.net This. .net framework document definition as a guide. Services are usually introduced guidebook should be aware that the database services, it affects the operation of a single target database. A class display by ado.net transaction boundaries described and methods of using the Service Guide will provide services. In the next chapter, I will focus on the Service Guide.

Auto Services is feasible, in order to participate in the use of services to coordinate across multiple data sources change. Affairs in such a scenario is dealt with in the outer layer, such as through the com + and DTC. For more automated services, you can automatically reference-related services.

Note: When there is no code in your acts specified services, you should pay attention to the default behavior of the database services. For example, sql Server default automatic mode, each Affairs-Sql statement or the success or failure. To learn more about what the default behavior is to get work from your data source, can help you decide whether to display the definition of your affairs, you can also understand the behavior of your system even more useful.

Services related overall

Ado.net data object through the Connection, Command, and Transaction Services to provide functional category. The affairs of a typical process similar to the following:

1. Open the Services through Connetion.BeginTransaction ()

2. Command.Transaction by setting the Command attribute in the affairs statement or stored procedure to join.

3. Rely on the provider, the option of using Transaction.Save () or Transaction.Begin () to create a savepoint or embedded to enable the affairs of local rollback.

4. Submit or rollback services through the use of Transaction.Commit () or Transaction.Rollback ()

All the data providers to provide the same basic structure to deal with the affairs of the affairs began to connect, join the command, use the Service to submit or rollback objects.

Sql Server Service

Sql Server data providers provide the basic functions of the Panel, see the following classes and members:

Class
Member
Function

SqlConnection
BeginTransaction
Open a new transaction.

SqlCommand
Transaction
Enlist the command associated with the object in an open transaction.

SqlTransaction
Save
Create a savepoint to enable a partial rollback.

SqlTransaction
Rollback
Roll back a transaction.

SqlTransaction
Commit
Commit a Transaction



Sql Server data providers (for Sql Server is, OLE DB provider is the case) does not offer to create embedded in the code the way, so embedded in the Sql Server Service is not true of the support. So here there is only one way to start a SqlClient of affairs - the use of SqlConnection.BeginTransaction (). You can not connections in a unified open a Service until the Service has been previously submitted or rolled back, so at any time, per connection There is only one open affairs. In order to use local rollback, use SqlTransaction.Save ().

OLE DB Services

OLE DB data providers to provide the basic functions of the Panel, see the following classes and members:

Class
Member
Function

OleDbConnection
BeginTransaction
Open a new transaction.

OleDbCommand
Transaction
Enlist the command associated with the object in an open transaction.

OleDbTransaction
Begin
Create a nested transaction, to enable a partial rollback.

OleDbTransaction
Rollback
Roll back a transaction.

OleDbTransaction
Commit
Commit a Transaction



OLE DB data provider does not provide any way to set savepoints, the opposite has a Begin () method in OleDbTransaction object. This allows you to create embedded services (based on your database) to provide similar functions. In this case you can in a single connection with multiple services. However, we must remember that the submission and show rollback call.

Remember,. NET OLE DB data providers embedded services you rely on the database and specify the OLE DB provider. In order to successfully implement embedded affairs, their must be your database and OLE DB providers support.

oracle Services

Oracle data provider to provide the basic functions of the Panel, see the following classes and members:

Class
Member
Function

OracleConnection
BeginTransaction
Open a new transaction.

OracleCommand
Transaction
Enlist the command associated with the object in an open transaction.

OracleTransaction
Rollback
Roll back a transaction.

OracleTransaction
Commit
Commit a Transaction



Oracle data provider does not allow you to specify or embedded Affairs savepoints. Savepoints by Oracle support, but you can not implement them for the current version of oracle data provider for. Services for the oracle, or to submit or rollback, partial rollback is impossible.




.Net Database Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.