-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIDataAccessRepository.cs
More file actions
197 lines (184 loc) · 7.8 KB
/
IDataAccessRepository.cs
File metadata and controls
197 lines (184 loc) · 7.8 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace RapidField.SolidInstruments.DataAccess
{
/// <summary>
/// Performs data access operations for a specified entity type.
/// </summary>
/// <typeparam name="TEntity">
/// The type of the entity.
/// </typeparam>
public interface IDataAccessRepository<TEntity> : IReadOnlyDataAccessRepository<TEntity>
where TEntity : class
{
/// <summary>
/// Adds the specified entity to the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="entity">
/// The entity to add.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="entity" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void Add(TEntity entity);
/// <summary>
/// Updates the specified entity in the current <see cref="IDataAccessRepository{TEntity}" />, or adds it if it doesn't
/// exist.
/// </summary>
/// <param name="entity">
/// The entity to add or update.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="entity" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void AddOrUpdate(TEntity entity);
/// <summary>
/// Updates the specified entities in the current <see cref="IDataAccessRepository{TEntity}" />, or adds them if they don't
/// exist.
/// </summary>
/// <param name="entities">
/// The entities to add or update.
/// </param>
/// <exception cref="ArgumentException">
/// <paramref name="entities" /> contains one or more null references.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="entities" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void AddOrUpdateRange(IEnumerable<TEntity> entities);
/// <summary>
/// Adds the specified entities to the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="entities">
/// The entities to add.
/// </param>
/// <exception cref="ArgumentException">
/// <paramref name="entities" /> contains one or more null references.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="entities" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void AddRange(IEnumerable<TEntity> entities);
/// <summary>
/// Removes the specified entity from the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="entity">
/// The entity to remove.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="entity" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void Remove(TEntity entity);
/// <summary>
/// Removes the specified entities from the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="entities">
/// The entities to remove.
/// </param>
/// <exception cref="ArgumentException">
/// <paramref name="entities" /> contains one or more null references.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="entities" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void RemoveRange(IEnumerable<TEntity> entities);
/// <summary>
/// Removes the entities matching the specified predicate from the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="predicate">
/// An expression to test each entity for a condition.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="predicate" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void RemoveWhere(Expression<Func<TEntity, Boolean>> predicate);
/// <summary>
/// Updates the specified entity in the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="entity">
/// The entity to update.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="entity" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void Update(TEntity entity);
/// <summary>
/// Updates the specified entities in the current <see cref="IDataAccessRepository{TEntity}" />.
/// </summary>
/// <param name="entities">
/// The entities to update.
/// </param>
/// <exception cref="ArgumentException">
/// <paramref name="entities" /> contains one or more null references.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="entities" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public void UpdateRange(IEnumerable<TEntity> entities);
}
/// <summary>
/// Performs data access operations for a specified entity type.
/// </summary>
public interface IDataAccessRepository : IAsyncDisposable, IDisposable
{
/// <summary>
/// Determines whether or not any entities exist in the current <see cref="IDataAccessRepository" />.
/// </summary>
/// <returns>
/// <see langword="true" /> if any entities exist in the current <see cref="IDataAccessRepository" />, otherwise
/// <see langword="false" />.
/// </returns>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public Boolean Any();
/// <summary>
/// Returns the number of entities in the current <see cref="IDataAccessRepository" />.
/// </summary>
/// <returns>
/// The number of entities in the current <see cref="IDataAccessRepository" />.
/// </returns>
/// <exception cref="ObjectDisposedException">
/// The object is disposed.
/// </exception>
public Int64 Count();
/// <summary>
/// Gets the entity type of the current <see cref="IDataAccessRepository" />.
/// </summary>
public Type EntityType
{
get;
}
}
}