/
IEntityStoreAsync.Generic.cs
35 lines (24 loc) · 1.11 KB
/
IEntityStoreAsync.Generic.cs
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
//Copyright (c) ServiceStack, Inc. All Rights Reserved.
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace ServiceStack.Data;
/// <summary>
/// For providers that want a cleaner API with a little more perf
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IEntityStoreAsync<T>
{
Task<T> GetByIdAsync(object id, CancellationToken token = default);
Task<IList<T>> GetByIdsAsync(IEnumerable ids, CancellationToken token = default);
Task<IList<T>> GetAllAsync(CancellationToken token = default);
Task<T> StoreAsync(T entity, CancellationToken token = default);
Task StoreAllAsync(IEnumerable<T> entities, CancellationToken token = default);
Task DeleteAsync(T entity, CancellationToken token = default);
Task DeleteByIdAsync(object id, CancellationToken token = default);
Task DeleteByIdsAsync(IEnumerable ids, CancellationToken token = default);
Task DeleteAllAsync(CancellationToken token = default);
}