-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathIRepository.cs
More file actions
83 lines (72 loc) · 4.09 KB
/
IRepository.cs
File metadata and controls
83 lines (72 loc) · 4.09 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Dotnet5.GraphQL3.Domain.Abstractions.Entities;
using Dotnet5.GraphQL3.Repositories.Abstractions.Pages;
using Microsoft.EntityFrameworkCore.Query;
namespace Dotnet5.GraphQL3.Repositories.Abstractions
{
public interface IRepository<TEntity, in TId>
where TEntity : Entity<TId>
where TId : struct
{
TEntity Add(TEntity entity);
Task<TEntity> AddAsync(TEntity entity, CancellationToken cancellationToken = default);
void Delete(TId id);
void Delete(TEntity entity);
Task DeleteAsync(TId id, CancellationToken cancellationToken = default);
bool Exists(TId id);
Task<bool> ExistsAsync(TId id, CancellationToken cancellationToken = default);
TEntity GetById(TId id, Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default, bool asTracking = default);
Task<TEntity> GetByIdAsync(TId id, CancellationToken cancellationToken, Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default, bool asTracking = default);
void Update(TEntity entity);
Task UpdateAsync(TEntity entity, CancellationToken cancellationToken = default);
PaginatedResult<TEntity> GetAll(
PageParams pageParams,
Expression<Func<TEntity, bool>> predicate = default,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = default,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default,
bool asTracking = default);
PaginatedResult<TResult> GetAllDynamically<TResult>(
PageParams pageParams,
IEnumerable<string> selected,
Func<List<object>, List<TResult>> mapping,
Expression<Func<TEntity, bool>> predicate = default,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = default,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default,
bool asTracking = default);
PaginatedResult<TResult> GetAllProjections<TResult>(
PageParams pageParams,
Expression<Func<TEntity, TResult>> selector = default,
Expression<Func<TEntity, bool>> predicate = default,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = default,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default,
bool asTracking = default);
Task<PaginatedResult<TEntity>> GetAllAsync(
PageParams pageParams,
CancellationToken cancellationToken,
Expression<Func<TEntity, bool>> predicate = default,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = default,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default,
bool asTracking = default);
Task<PaginatedResult<TResult>> GetAllDynamicallyAsync<TResult>(
PageParams pageParams,
IEnumerable<string> selected,
Func<List<object>, List<TResult>> mapping,
Expression<Func<TEntity, bool>> predicate = default,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = default,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default,
bool asTracking = default);
Task<PaginatedResult<TResult>> GetAllProjectionsAsync<TResult>(
PageParams pageParams,
CancellationToken cancellationToken,
Expression<Func<TEntity, TResult>> selector = default,
Expression<Func<TEntity, bool>> predicate = default,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = default,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> include = default,
bool asTracking = default);
}
}