forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAdapterWithTransactions.cs
More file actions
66 lines (58 loc) · 4.4 KB
/
IAdapterWithTransactions.cs
File metadata and controls
66 lines (58 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Simple.Data
{
public interface IAdapterWithTransactions
{
IAdapterTransaction BeginTransaction();
IAdapterTransaction BeginTransaction(string name);
/// <summary>
/// Finds data from the specified "table".
/// </summary>
/// <param name="tableName">Name of the table.</param><param name="criteria">The criteria. This may be <c>null</c>, in which case all records should be returned.</param>
/// <param name="transaction">The transaction with which the operation is associated.</param>
/// <returns>The list of records matching the criteria. If no records are found, return an empty list.</returns>
IEnumerable<IDictionary<string, object>> Find(string tableName, SimpleExpression criteria, IAdapterTransaction transaction);
/// <summary>
/// Inserts a record into the specified "table".
/// </summary>
/// <param name="tableName">Name of the table.</param><param name="data">The values to insert.</param>
/// <param name="transaction">The transaction with which the operation is associated.</param>
/// <returns>If possible, return the newly inserted row, including any automatically-set values such as primary keys or timestamps.</returns>
IDictionary<string, object> Insert(string tableName, IDictionary<string, object> data, IAdapterTransaction transaction, bool resultRequired);
/// <summary>
/// Inserts many records into the specified "table".
/// </summary>
/// <param name="tableName">Name of the table.</param>
/// <param name="data">The list of records to insert.</param>
/// <param name="transaction">The transaction with which the operation is associated.</param>
/// <returns>If possible, return the newly inserted rows, including any automatically-set values such as primary keys or timestamps.</returns>
IEnumerable<IDictionary<string, object>> InsertMany(string tableName, IEnumerable<IDictionary<string, object>> data, IAdapterTransaction transaction, Func<IDictionary<string,object>,Exception,bool> onError, bool resultRequired);
/// <summary>
/// Updates the specified "table" according to specified criteria.
/// </summary>
/// <param name="tableName">Name of the table.</param><param name="data">The new values.</param><param name="criteria">The expression to use as criteria for the update operation.</param>
/// <param name="transaction">The transaction with which the operation is associated.</param>
/// <returns>The number of records affected by the update operation.</returns>
int Update(string tableName, IDictionary<string, object> data, SimpleExpression criteria, IAdapterTransaction transaction);
/// <summary>
/// Deletes from the specified table.
/// </summary>
/// <param name="tableName">Name of the table.</param><param name="criteria">The expression to use as criteria for the delete operation.</param>
/// <param name="transaction">The transaction with which the operation is associated.</param>
/// <returns>The number of records which were deleted.</returns>
int Delete(string tableName, SimpleExpression criteria, IAdapterTransaction transaction);
/// <summary>
/// Updates the specified "table" according to primary key information where available.
/// </summary>
/// <param name="tableName">Name of the table.</param><param name="dataList">The new values.</param>
/// <param name="adapterTransaction">The transaction with which the operation is associated.</param>
/// <returns>The number of records affected by the update operation.</returns>
int UpdateMany(string tableName, IEnumerable<IDictionary<string, object>> dataList, IAdapterTransaction adapterTransaction);
int UpdateMany(string tableName, IEnumerable<IDictionary<string, object>> dataList, IAdapterTransaction adapterTransaction, IList<string> keyFields);
int Update(string tableName, IDictionary<string, object> data, IAdapterTransaction adapterTransaction);
int UpdateMany(string tableName, IList<IDictionary<string, object>> dataList, IEnumerable<string> criteriaFieldNames, IAdapterTransaction adapterTransaction);
}
}