@@ -69,7 +69,6 @@ public static void Close()
6969 return _dbServiceImplementation . CountAsync < TState > ( filter ) ;
7070 }
7171
72-
7372 /// <summary>
7473 /// 以升序方式查找符合条件的第一个元素。
7574 /// </summary>
@@ -122,7 +121,6 @@ public static void Close()
122121 return _dbServiceImplementation . FindSortAscendingAsync < TState > ( filter , sortExpression , pageIndex , pageSize ) ;
123122 }
124123
125-
126124 /// <summary>
127125 /// 加载指定id的文档
128126 /// </summary>
@@ -168,6 +166,60 @@ public static void Close()
168166 return _dbServiceImplementation . AddAsync < TState > ( state ) ;
169167 }
170168
169+ /// <summary>
170+ /// 增加或更新数据
171+ /// </summary>
172+ /// <param name="state">数据对象</param>
173+ /// <typeparam name="TState">实现ICacheState接口的类型。</typeparam>
174+ /// <returns>修改的条数</returns>
175+ public static Task < long > AddOrUpdateAsync < TState > ( TState state ) where TState : class , ICacheState , new ( )
176+ {
177+ return _dbServiceImplementation . AddOrUpdateAsync < TState > ( state ) ;
178+ }
179+
180+ /// <summary>
181+ /// 保存多条数据
182+ /// </summary>
183+ /// <param name="states">数据对象</param>
184+ /// <typeparam name="TState">实现ICacheState接口的类型。</typeparam>
185+ /// <returns></returns>
186+ public static Task AddListAsync < TState > ( IEnumerable < TState > states ) where TState : class , ICacheState , new ( )
187+ {
188+ return _dbServiceImplementation . AddListAsync < TState > ( states ) ;
189+ }
190+
191+ /// <summary>
192+ /// 更新多条数据
193+ /// </summary>
194+ /// <param name="stateList">数据列表对象</param>
195+ /// <returns>返回更新成功的数量</returns>
196+ public static Task < long > UpdateAsync < TState > ( IEnumerable < TState > stateList ) where TState : class , ICacheState , new ( )
197+ {
198+ return _dbServiceImplementation . UpdateAsync < TState > ( stateList ) ;
199+ }
200+
201+ /// <summary>
202+ /// 查询符合条件的数据是否存在
203+ /// </summary>
204+ /// <param name="filter">查询条件</param>
205+ /// <typeparam name="TState">实现ICacheState接口的类型。</typeparam>
206+ /// <returns>返回是否存在值,true表示存在,false表示不存在</returns>
207+ public static bool Any < TState > ( Expression < Func < TState , bool > > filter ) where TState : class , ICacheState , new ( )
208+ {
209+ return _dbServiceImplementation . Any < TState > ( filter ) ;
210+ }
211+
212+ /// <summary>
213+ /// 查询符合条件的数据是否存在
214+ /// </summary>
215+ /// <param name="filter">查询条件</param>
216+ /// <typeparam name="TState">实现ICacheState接口的类型。</typeparam>
217+ /// <returns>返回是否存在值,true表示存在,false表示不存在</returns>
218+ public static Task < bool > AnyAsync < TState > ( Expression < Func < TState , bool > > filter ) where TState : class , ICacheState , new ( )
219+ {
220+ return _dbServiceImplementation . AnyAsync < TState > ( filter ) ;
221+ }
222+
171223 /// <summary>
172224 /// 异步删除与指定过滤器匹配的文档
173225 /// </summary>
0 commit comments