Skip to content

Commit c9e4b3f

Browse files
committed
add IJsonApiContext
1 parent 5f8e176 commit c9e4b3f

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using JsonApiDotNetCore.Configuration;
3+
using JsonApiDotNetCore.Routing;
4+
using Microsoft.AspNetCore.Http;
5+
6+
namespace JsonApiDotNetCore.Abstractions
7+
{
8+
public interface IJsonApiContext
9+
{
10+
JsonApiModelConfiguration Configuration { get; }
11+
object DbContext { get; }
12+
HttpContext HttpContext { get; }
13+
Route Route { get; }
14+
string GetEntityName();
15+
Type GetEntityType();
16+
Type GetJsonApiResourceType();
17+
}
18+
}

JsonApiDotNetCore/Abstractions/JsonApiContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace JsonApiDotNetCore.Abstractions
99
{
10-
public class JsonApiContext
10+
public class JsonApiContext : IJsonApiContext
1111
{
1212
public HttpContext HttpContext { get; }
1313
public Route Route { get; }

JsonApiDotNetCore/Controllers/JsonApiController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ namespace JsonApiDotNetCore.Controllers
88
{
99
public class JsonApiController : IJsonApiController
1010
{
11-
protected readonly JsonApiContext JsonApiContext;
11+
protected readonly IJsonApiContext JsonApiContext;
1212
private readonly ResourceRepository _resourceRepository;
1313

14-
public JsonApiController(JsonApiContext jsonApiContext, ResourceRepository resourceRepository)
14+
public JsonApiController(IJsonApiContext jsonApiContext, ResourceRepository resourceRepository)
1515
{
1616
JsonApiContext = jsonApiContext;
1717
_resourceRepository = resourceRepository;

0 commit comments

Comments
 (0)