7
7
using JsonApiDotNetCore . Resources ;
8
8
using JsonApiDotNetCore . Resources . Annotations ;
9
9
using JsonApiDotNetCore . Services ;
10
- using NoEntityFrameworkExample . Data ;
10
+ using Microsoft . EntityFrameworkCore . Metadata ;
11
11
12
12
namespace NoEntityFrameworkExample . Services ;
13
13
@@ -30,32 +30,19 @@ namespace NoEntityFrameworkExample.Services;
30
30
/// <typeparam name="TId">
31
31
/// The resource identifier type.
32
32
/// </typeparam>
33
- public abstract class InMemoryResourceService < TResource , TId > : IResourceQueryService < TResource , TId >
33
+ public abstract class InMemoryResourceService < TResource , TId > (
34
+ IJsonApiOptions options , IResourceGraph resourceGraph , IQueryLayerComposer queryLayerComposer , IPaginationContext paginationContext ,
35
+ IEnumerable < IQueryConstraintProvider > constraintProviders , IQueryableBuilder queryableBuilder , IReadOnlyModel entityModel ,
36
+ ILoggerFactory loggerFactory ) : IResourceQueryService < TResource , TId >
34
37
where TResource : class , IIdentifiable < TId >
35
38
{
36
- private readonly IJsonApiOptions _options ;
37
- private readonly IQueryLayerComposer _queryLayerComposer ;
38
- private readonly IPaginationContext _paginationContext ;
39
- private readonly IEnumerable < IQueryConstraintProvider > _constraintProviders ;
40
- private readonly ILogger < InMemoryResourceService < TResource , TId > > _logger ;
41
- private readonly ResourceType _resourceType ;
42
- private readonly QueryLayerToLinqConverter _queryLayerToLinqConverter ;
43
-
44
- protected InMemoryResourceService ( IJsonApiOptions options , IResourceGraph resourceGraph , IQueryLayerComposer queryLayerComposer ,
45
- IPaginationContext paginationContext , IEnumerable < IQueryConstraintProvider > constraintProviders , IQueryableBuilder queryableBuilder ,
46
- ILoggerFactory loggerFactory )
47
- {
48
- _options = options ;
49
- _queryLayerComposer = queryLayerComposer ;
50
- _paginationContext = paginationContext ;
51
- _constraintProviders = constraintProviders ;
52
-
53
- _logger = loggerFactory . CreateLogger < InMemoryResourceService < TResource , TId > > ( ) ;
54
- _resourceType = resourceGraph . GetResourceType < TResource > ( ) ;
55
-
56
- var model = new InMemoryModel ( resourceGraph ) ;
57
- _queryLayerToLinqConverter = new QueryLayerToLinqConverter ( model , queryableBuilder ) ;
58
- }
39
+ private readonly IJsonApiOptions _options = options ;
40
+ private readonly IQueryLayerComposer _queryLayerComposer = queryLayerComposer ;
41
+ private readonly IPaginationContext _paginationContext = paginationContext ;
42
+ private readonly IEnumerable < IQueryConstraintProvider > _constraintProviders = constraintProviders ;
43
+ private readonly ILogger < InMemoryResourceService < TResource , TId > > _logger = loggerFactory . CreateLogger < InMemoryResourceService < TResource , TId > > ( ) ;
44
+ private readonly ResourceType _resourceType = resourceGraph . GetResourceType < TResource > ( ) ;
45
+ private readonly QueryLayerToLinqConverter _queryLayerToLinqConverter = new ( entityModel , queryableBuilder ) ;
59
46
60
47
/// <inheritdoc />
61
48
public Task < IReadOnlyCollection < TResource > > GetAsync ( CancellationToken cancellationToken )
0 commit comments