1 | using System;
|
---|
2 | using System.Data;
|
---|
3 |
|
---|
4 | namespace IndianHealthService.BMXNet.Ado
|
---|
5 | {
|
---|
6 | /// <summary>
|
---|
7 | /// BMXNET implementaiton of IDbTransaction. This class can be used like
|
---|
8 | /// any ADO.NET IDbTransaction implementation or the suggested RemoteSession API's can
|
---|
9 | /// be used.
|
---|
10 | ///
|
---|
11 | /// See ADO.NET documentation for details of this class.
|
---|
12 | /// </summary>
|
---|
13 |
|
---|
14 | public class BMXNetTransaction : IDbTransaction
|
---|
15 | {
|
---|
16 | public IsolationLevel IsolationLevel
|
---|
17 | {
|
---|
18 | /*
|
---|
19 | * Should return the current transaction isolation
|
---|
20 | * level. For the BMXNet, assume the default
|
---|
21 | * which is ReadCommitted.
|
---|
22 | */
|
---|
23 | get { return IsolationLevel.ReadCommitted; }
|
---|
24 | }
|
---|
25 |
|
---|
26 | public void Commit()
|
---|
27 | {
|
---|
28 | /*
|
---|
29 | * Implement Commit here. Although the BMXNet does
|
---|
30 | * not provide an implementation, it should never be
|
---|
31 | * a no-op because data corruption could result.
|
---|
32 | */
|
---|
33 | }
|
---|
34 |
|
---|
35 | public void Rollback()
|
---|
36 | {
|
---|
37 | /*
|
---|
38 | * Implement Rollback here. Although the BMXNet does
|
---|
39 | * not provide an implementation, it should never be
|
---|
40 | * a no-op because data corruption could result.
|
---|
41 | */
|
---|
42 | }
|
---|
43 |
|
---|
44 | public IDbConnection Connection
|
---|
45 | {
|
---|
46 | /*
|
---|
47 | * Return the connection for the current transaction.
|
---|
48 | */
|
---|
49 |
|
---|
50 | get { return this.Connection; }
|
---|
51 | }
|
---|
52 |
|
---|
53 | public void Dispose()
|
---|
54 | {
|
---|
55 | this.Dispose(true);
|
---|
56 | System.GC.SuppressFinalize(this);
|
---|
57 | }
|
---|
58 |
|
---|
59 | private void Dispose(bool disposing)
|
---|
60 | {
|
---|
61 | if (disposing)
|
---|
62 | {
|
---|
63 | if (null != this.Connection)
|
---|
64 | {
|
---|
65 | // implicitly rollback if transaction still valid
|
---|
66 | this.Rollback();
|
---|
67 | }
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | }
|
---|
72 | }
|
---|