Skip to content

Commit

Permalink
Merge pull request json-api-dotnet#265 from json-api-dotnet/feat/json…
Browse files Browse the repository at this point in the history
…-api-dotnet#239

make private service methods protected virtual
  • Loading branch information
jaredcnance authored Apr 22, 2018
2 parents e7c65db + e65ad92 commit 6223645
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/JsonApiDotNetCore/Controllers/JsonApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public JsonApiController(
: base(jsonApiContext, resourceService, loggerFactory)
{ }

public JsonApiController(
IJsonApiContext jsonApiContext,
IResourceService<T, int> resourceService)
: base(jsonApiContext, resourceService)
{ }

public JsonApiController(
IJsonApiContext jsonApiContext,
IGetAllService<T, int> getAll = null,
Expand Down
4 changes: 2 additions & 2 deletions src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>2.2.1</VersionPrefix>
<VersionPrefix>2.2.2</VersionPrefix>
<TargetFrameworks>$(NetStandardVersion)</TargetFrameworks>
<AssemblyName>JsonApiDotNetCore</AssemblyName>
<PackageId>JsonApiDotNetCore</PackageId>
Expand Down Expand Up @@ -35,4 +35,4 @@
<PackageReference Include="docfx.console" Version="2.33.0" />
</ItemGroup>

</Project>
</Project>
6 changes: 3 additions & 3 deletions src/JsonApiDotNetCore/Services/EntityResourceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public virtual async Task<bool> DeleteAsync(TId id)
return await _entities.DeleteAsync(id);
}

private IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)
protected virtual IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)
{
var query = _jsonApiContext.QuerySet;

Expand All @@ -163,7 +163,7 @@ private IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)
return entities;
}

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

private IQueryable<T> IncludeRelationships(IQueryable<T> entities, List<string> relationships)
protected virtual IQueryable<T> IncludeRelationships(IQueryable<T> entities, List<string> relationships)
{
_jsonApiContext.IncludedRelationships = relationships;

Expand Down

0 comments on commit 6223645

Please sign in to comment.