|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | + |
| 6 | +namespace Simple.Data |
| 7 | +{ |
| 8 | + public partial class InMemoryAdapter : IAdapterWithTransactions |
| 9 | + { |
| 10 | + class InMemoryAdapterTransaction : IAdapterTransaction |
| 11 | + { |
| 12 | + private readonly string _name; |
| 13 | + |
| 14 | + public InMemoryAdapterTransaction() : this(string.Empty) |
| 15 | + { |
| 16 | + } |
| 17 | + |
| 18 | + public InMemoryAdapterTransaction(string name) |
| 19 | + { |
| 20 | + _name = name; |
| 21 | + } |
| 22 | + |
| 23 | + public void Dispose() |
| 24 | + { |
| 25 | + } |
| 26 | + |
| 27 | + public void Commit() |
| 28 | + { |
| 29 | + } |
| 30 | + |
| 31 | + public void Rollback() |
| 32 | + { |
| 33 | + } |
| 34 | + |
| 35 | + public string Name |
| 36 | + { |
| 37 | + get { return _name; } |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + public IAdapterTransaction BeginTransaction() |
| 42 | + { |
| 43 | + return new InMemoryAdapterTransaction(); |
| 44 | + } |
| 45 | + |
| 46 | + public IAdapterTransaction BeginTransaction(string name) |
| 47 | + { |
| 48 | + return new InMemoryAdapterTransaction(name); |
| 49 | + } |
| 50 | + |
| 51 | + public IEnumerable<IDictionary<string, object>> Find(string tableName, SimpleExpression criteria, IAdapterTransaction transaction) |
| 52 | + { |
| 53 | + return Find(tableName, criteria); |
| 54 | + } |
| 55 | + |
| 56 | + public IDictionary<string, object> Insert(string tableName, IDictionary<string, object> data, IAdapterTransaction transaction, bool resultRequired) |
| 57 | + { |
| 58 | + return Insert(tableName, data, resultRequired); |
| 59 | + } |
| 60 | + |
| 61 | + public IEnumerable<IDictionary<string, object>> InsertMany(string tableName, IEnumerable<IDictionary<string, object>> data, IAdapterTransaction transaction, Func<IDictionary<string, object>, Exception, bool> onError, bool resultRequired) |
| 62 | + { |
| 63 | + return InsertMany(tableName, data, onError, resultRequired); |
| 64 | + } |
| 65 | + |
| 66 | + public int Update(string tableName, IDictionary<string, object> data, SimpleExpression criteria, IAdapterTransaction transaction) |
| 67 | + { |
| 68 | + return Update(tableName, data, criteria); |
| 69 | + } |
| 70 | + |
| 71 | + public int Delete(string tableName, SimpleExpression criteria, IAdapterTransaction transaction) |
| 72 | + { |
| 73 | + return Delete(tableName, criteria); |
| 74 | + } |
| 75 | + |
| 76 | + public int UpdateMany(string tableName, IEnumerable<IDictionary<string, object>> dataList, IAdapterTransaction adapterTransaction) |
| 77 | + { |
| 78 | + return UpdateMany(tableName, dataList); |
| 79 | + } |
| 80 | + |
| 81 | + public int UpdateMany(string tableName, IEnumerable<IDictionary<string, object>> dataList, IAdapterTransaction adapterTransaction, IList<string> keyFields) |
| 82 | + { |
| 83 | + return UpdateMany(tableName, dataList, keyFields); |
| 84 | + } |
| 85 | + |
| 86 | + public int Update(string tableName, IDictionary<string, object> data, IAdapterTransaction adapterTransaction) |
| 87 | + { |
| 88 | + return Update(tableName, data); |
| 89 | + } |
| 90 | + |
| 91 | + public int UpdateMany(string tableName, IList<IDictionary<string, object>> dataList, IEnumerable<string> criteriaFieldNames, IAdapterTransaction adapterTransaction) |
| 92 | + { |
| 93 | + return UpdateMany(tableName, dataList, criteriaFieldNames); |
| 94 | + } |
| 95 | + } |
| 96 | +} |
0 commit comments