55 using System . Threading . Tasks ;
66
77 /// <summary>
8- /// Provides basic DDL and CRUD command definitions and a DI-supplied Context
8+ /// Provides basic DDL and CRUD command definitions and a DI-supplied Context.
99 /// </summary>
1010 public interface ILiteDbSet
1111 {
@@ -48,17 +48,84 @@ public interface ILiteDbSet
4848 /// Gets the delete definition where.
4949 /// </summary>
5050 string DeleteDefinitionWhere { get ; }
51+
52+ /// <summary>
53+ /// Gets any definition.
54+ /// </summary>
55+ string AnyDefinition { get ; }
5156
5257 /// <summary>
5358 /// Gets or sets the parent set context.
5459 /// </summary>
5560 LiteDbContext Context { get ; set ; }
61+
62+ /// <summary>
63+ /// Provides and asynchronous counterpart to the Count method.
64+ /// </summary>
65+ /// <returns>A Task with the total number of rows.</returns>
66+ Task < int > CountAsync ( ) ;
67+
68+ /// <summary>
69+ /// Counts the total number of rows in the table.
70+ /// </summary>
71+ /// <returns>
72+ /// The total number of rows.
73+ /// </returns>
74+ int Count ( ) ;
75+
76+ /// <summary>
77+ /// Provides and asynchronous counterpart to the Count method.
78+ /// </summary>
79+ /// <param name="whereText">The where text.</param>
80+ /// <param name="whereParams">The where parameters.</param>
81+ /// <returns>
82+ /// A Task with the total number of rows.
83+ /// </returns>
84+ Task < int > CountAsync ( string whereText , object whereParams = null ) ;
85+
86+ /// <summary>
87+ /// Provides and asynchronous counterpart to the Count method.
88+ /// </summary>
89+ /// <param name="whereText">The where text.</param>
90+ /// <param name="whereParams">The where parameters.</param>
91+ /// <returns>
92+ /// The total number of rows.
93+ /// </returns>
94+ int Count ( string whereText , object whereParams = null ) ;
95+
96+ /// <summary>
97+ /// Check if the row exist in the table.
98+ /// </summary>
99+ /// <returns><c>true</c> if the query contains data, otherwise <c>false</c>.</returns>
100+ bool Any ( ) ;
101+
102+ /// <summary>
103+ /// Check if the row exist in the table.
104+ /// </summary>
105+ /// <param name="whereText">The where text.</param>
106+ /// <param name="whereParams">The where parameters.</param>
107+ /// <returns><c>true</c> if the query contains data, otherwise <c>false</c>.</returns>
108+ bool Any ( string whereText , object whereParams = null ) ;
109+
110+ /// <summary>
111+ /// Check asynchronous if the row exist in the table.
112+ /// </summary>
113+ /// <param name="whereText">The where text.</param>
114+ /// <param name="whereParams">The where parameters.</param>
115+ /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
116+ Task < bool > AnyAsync ( string whereText , object whereParams = null ) ;
117+
118+ /// <summary>
119+ /// Check asynchronous if the table contains data.
120+ /// </summary>
121+ /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
122+ Task < bool > AnyAsync ( ) ;
56123 }
57124
58125 /// <summary>
59- /// Provides typed access to querying the database
126+ /// Provides typed access to querying the database.
60127 /// </summary>
61- /// <typeparam name="T">The type of LiteModel</typeparam>
128+ /// <typeparam name="T">The type of LiteModel. </typeparam>
62129 public interface ILiteDbSet < T > : ILiteDbSet
63130 where T : ILiteModel
64131 {
@@ -103,39 +170,40 @@ public interface ILiteDbSet<T> : ILiteDbSet
103170 /// Selects a single entity from the databse given its row id.
104171 /// </summary>
105172 /// <param name="rowId">The row identifier.</param>
106- /// <returns>A generic type</returns>
173+ /// <returns>A generic type. </returns>
107174 T Single ( long rowId ) ;
108175
109176 /// <summary>
110- /// Counts the total number of rows in the table
177+ /// Inserts the specified entities.
111178 /// </summary>
112- /// <returns>The total number of rows</returns>
113- int Count ( ) ;
179+ /// <param name="entities">The entities.</param>
180+ /// <exception cref="ArgumentNullException">entities.</exception>
181+ void InsertRange ( IEnumerable < T > entities ) ;
114182
115183 /// <summary>
116- /// Provides and asynchronous counterpart to the Insert method
184+ /// Provides and asynchronous counterpart to the Insert method.
117185 /// </summary>
118186 /// <param name="entity">The entity.</param>
119- /// <returns>A Task with the number of rows inserted</returns>
187+ /// <returns>A Task with the number of rows inserted. </returns>
120188 Task < int > InsertAsync ( T entity ) ;
121189
122190 /// <summary>
123- /// Provides and asynchronous counterpart to the Delete method
191+ /// Provides and asynchronous counterpart to the Delete method.
124192 /// </summary>
125193 /// <param name="entity">The entity.</param>
126194 /// <returns>A Task with the number of rows deleted</returns>
127195 Task < int > DeleteAsync ( T entity ) ;
128196
129197 /// <summary>
130- /// Provides and asynchronous counterpart to the Update method
198+ /// Provides and asynchronous counterpart to the Update method.
131199 /// </summary>
132200 /// <param name="entity">The entity.</param>
133201 /// <returns>A Task with the number of rows updated</returns>
134202 Task < int > UpdateAsync ( T entity ) ;
135203
136204 /// <summary>
137205 /// Deletes the specified where text.
138- /// Example whereText = "X = @X" and whereParames = new { X = "hello" }
206+ /// Example whereText = "X = @X" and whereParames = new { X = "hello" }.
139207 /// </summary>
140208 /// <param name="whereText">The where text.</param>
141209 /// <param name="whereParams">The where parameters.</param>
@@ -164,18 +232,30 @@ public interface ILiteDbSet<T> : ILiteDbSet
164232 /// </summary>
165233 /// <returns>A Task of type Enumerable with a generic type.</returns>
166234 Task < IEnumerable < T > > SelectAllAsync ( ) ;
167-
235+
168236 /// <summary>
169237 /// Provides and asynchronous counterpart to the Single method.
170238 /// </summary>
171239 /// <param name="rowId">The row identifier.</param>
172- /// <returns>A Task with a generyc type.</returns>
240+ /// <returns>
241+ /// A Task with a generyc type.
242+ /// </returns>
173243 Task < T > SingleAsync ( long rowId ) ;
174244
175245 /// <summary>
176- /// Provides and asynchronous counterpart to the Count method .
246+ /// Firsts the or default .
177247 /// </summary>
178- /// <returns>A Task with the total number of rows.</returns>
179- Task < int > CountAsync ( ) ;
248+ /// <param name="fieldName">Name of the field.</param>
249+ /// <param name="fieldValue">The field value.</param>
250+ /// <returns> A generic type</returns>
251+ T FirstOrDefault ( string fieldName , object fieldValue ) ;
252+
253+ /// <summary>
254+ /// Firsts the or default asynchronous.
255+ /// </summary>
256+ /// <param name="fieldName">Name of the field.</param>
257+ /// <param name="fieldValue">The field value.</param>
258+ /// <returns>A Task with a generic type.</returns>
259+ Task < T > FirstOrDefaultAsync ( string fieldName , object fieldValue ) ;
180260 }
181261}
0 commit comments