Skip to content

Commit a8d8d60

Browse files
authored
Merge pull request #265 from json-api-dotnet/feat/#239
make private service methods protected virtual
2 parents 906c697 + 8c06ae3 commit a8d8d60

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/JsonApiDotNetCore/Controllers/JsonApiController.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ public JsonApiController(
1717
: base(jsonApiContext, resourceService, loggerFactory)
1818
{ }
1919

20+
public JsonApiController(
21+
IJsonApiContext jsonApiContext,
22+
IResourceService<T, int> resourceService)
23+
: base(jsonApiContext, resourceService)
24+
{ }
25+
2026
public JsonApiController(
2127
IJsonApiContext jsonApiContext,
2228
IGetAllService<T, int> getAll = null,

src/JsonApiDotNetCore/JsonApiDotNetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<VersionPrefix>2.2.1</VersionPrefix>
3+
<VersionPrefix>2.2.2</VersionPrefix>
44
<TargetFrameworks>$(NetStandardVersion)</TargetFrameworks>
55
<AssemblyName>JsonApiDotNetCore</AssemblyName>
66
<PackageId>JsonApiDotNetCore</PackageId>
@@ -35,4 +35,4 @@
3535
<PackageReference Include="docfx.console" Version="2.33.0" />
3636
</ItemGroup>
3737

38-
</Project>
38+
</Project>

src/JsonApiDotNetCore/Services/EntityResourceService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public virtual async Task<bool> DeleteAsync(TId id)
146146
return await _entities.DeleteAsync(id);
147147
}
148148

149-
private IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)
149+
protected virtual IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)
150150
{
151151
var query = _jsonApiContext.QuerySet;
152152

@@ -163,7 +163,7 @@ private IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)
163163
return entities;
164164
}
165165

166-
private async Task<IEnumerable<T>> ApplyPageQueryAsync(IQueryable<T> entities)
166+
protected virtual async Task<IEnumerable<T>> ApplyPageQueryAsync(IQueryable<T> entities)
167167
{
168168
var pageManager = _jsonApiContext.PageManager;
169169
if (!pageManager.IsPaginated)
@@ -174,7 +174,7 @@ private async Task<IEnumerable<T>> ApplyPageQueryAsync(IQueryable<T> entities)
174174
return await _entities.PageAsync(entities, pageManager.PageSize, pageManager.CurrentPage);
175175
}
176176

177-
private IQueryable<T> IncludeRelationships(IQueryable<T> entities, List<string> relationships)
177+
protected virtual IQueryable<T> IncludeRelationships(IQueryable<T> entities, List<string> relationships)
178178
{
179179
_jsonApiContext.IncludedRelationships = relationships;
180180

0 commit comments

Comments
 (0)