Skip to content

Commit d6c403c

Browse files
authored
Separation of concerns ResourceGraph (#586)
* refactor: move HasManyThrough GetValue and SetValue logic to HasManyThroughAttribute * feat: remove GetPublicAttributeName from ResourceGraph and remove dependency on ResourceGraph of controller layer * style: spacing in BaseJsonApiController<,> * feat: remove GetEntityFromControllerName from ResourceGraph * feat: remove GetInverseRelationship from ResourceGraph * feat: decouples UsesDbContext from ResourceGraph and introduces decoupled application instantation * chore: remove redundant injections of IResourceGraph * refactor: merge IContextEntityProvider and IFieldsExplorer into IResourceGraphExplorer * style: cleanup of variable names * chore: various fixes for PR review, mostly style and variable naming * style: rename IResourceGraphExplorer back to IResourceGraph, consitent usage of IContextEntityProvider * docs: comments for DefaultActionFilter and DefaultTypeFilter * docs: comments JsonApiApplicationBuilder * style: consistent variable naming| * chore: wire up IControllerResourceMapping * refactor: routing convention implements controller mapping interface
1 parent 928ac1e commit d6c403c

File tree

106 files changed

+977
-1143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+977
-1143
lines changed

src/Examples/GettingStarted/Controllers/ArticlesController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ public class ArticlesController : JsonApiController<Article>
1010
{
1111
public ArticlesController(
1212
IJsonApiOptions jsonApiOptions,
13-
IResourceGraph resourceGraph,
1413
IResourceService<Article> resourceService)
15-
: base(jsonApiOptions, resourceGraph, resourceService)
14+
: base(jsonApiOptions, resourceService)
1615
{ }
1716
}
1817
}

src/Examples/GettingStarted/Controllers/PeopleController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ public class PeopleController : JsonApiController<Person>
1010
{
1111
public PeopleController(
1212
IJsonApiOptions jsonApiOptions,
13-
IResourceGraph resourceGraph,
1413
IResourceService<Person> resourceService)
15-
: base(jsonApiOptions, resourceGraph, resourceService)
14+
: base(jsonApiOptions, resourceService)
1615
{ }
1716
}
1817
}

src/Examples/GettingStarted/ResourceDefinitionExample/ModelDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace GettingStarted.ResourceDefinitionExample
66
{
77
public class ModelDefinition : ResourceDefinition<Model>
88
{
9-
public ModelDefinition(IResourceGraph graph) : base(graph)
9+
public ModelDefinition(IContextEntityProvider provider) : base(provider)
1010
{
1111
}
1212

src/Examples/GettingStarted/ResourceDefinitionExample/ModelsController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ public class ModelsController : JsonApiController<Model>
99
{
1010
public ModelsController(
1111
IJsonApiOptions jsonApiOptions,
12-
IResourceGraph resourceGraph,
1312
IResourceService<Model> resourceService)
14-
: base(jsonApiOptions, resourceGraph, resourceService)
13+
: base(jsonApiOptions, resourceService)
1514
{ }
1615
}
1716
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using JsonApiDotNetCore.Configuration;
22
using JsonApiDotNetCore.Controllers;
3-
using JsonApiDotNetCore.Internal.Contracts;
43
using JsonApiDotNetCore.Services;
54
using JsonApiDotNetCoreExample.Models;
65

@@ -10,9 +9,8 @@ public class ArticlesController : JsonApiController<Article>
109
{
1110
public ArticlesController(
1211
IJsonApiOptions jsonApiOptions,
13-
IResourceGraph resourceGraph,
1412
IResourceService<Article> resourceService)
15-
: base(jsonApiOptions, resourceGraph, resourceService)
13+
: base(jsonApiOptions, resourceService)
1614
{ }
1715
}
1816
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using JsonApiDotNetCore.Configuration;
22
using JsonApiDotNetCore.Controllers;
3-
using JsonApiDotNetCore.Internal.Contracts;
43
using JsonApiDotNetCore.Services;
54
using JsonApiDotNetCoreExample.Models;
65
using Microsoft.Extensions.Logging;
@@ -11,10 +10,9 @@ public class CamelCasedModelsController : JsonApiController<CamelCasedModel>
1110
{
1211
public CamelCasedModelsController(
1312
IJsonApiOptions jsonApiOptions,
14-
IResourceGraph resourceGraph,
1513
IResourceService<CamelCasedModel> resourceService,
1614
ILoggerFactory loggerFactory)
17-
: base(jsonApiOptions, resourceGraph, resourceService, loggerFactory)
15+
: base(jsonApiOptions, resourceService, loggerFactory)
1816
{ }
1917
}
2018
}

src/Examples/JsonApiDotNetCoreExample/Controllers/PassportsController.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using JsonApiDotNetCore.Configuration;
22
using JsonApiDotNetCore.Controllers;
3-
using JsonApiDotNetCore.Internal.Contracts;
43
using JsonApiDotNetCore.Services;
54
using JsonApiDotNetCoreExample.Models;
65
using Microsoft.Extensions.Logging;
@@ -9,7 +8,10 @@ namespace JsonApiDotNetCoreExample.Controllers
98
{
109
public class PassportsController : JsonApiController<Passport>
1110
{
12-
public PassportsController(IJsonApiOptions jsonApiOptions, IResourceGraph resourceGraph, IResourceService<Passport, int> resourceService, ILoggerFactory loggerFactory = null) : base(jsonApiOptions, resourceGraph, resourceService, loggerFactory)
11+
public PassportsController(IJsonApiOptions jsonApiOptions,
12+
IResourceService<Passport, int> resourceService,
13+
ILoggerFactory loggerFactory = null)
14+
: base(jsonApiOptions, resourceService, loggerFactory)
1315
{
1416
}
1517
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using JsonApiDotNetCore.Configuration;
22
using JsonApiDotNetCore.Controllers;
3-
using JsonApiDotNetCore.Internal.Contracts;
43
using JsonApiDotNetCore.Services;
54
using JsonApiDotNetCoreExample.Models;
65
using Microsoft.Extensions.Logging;
@@ -11,10 +10,9 @@ public class PeopleController : JsonApiController<Person>
1110
{
1211
public PeopleController(
1312
IJsonApiOptions jsonApiOptions,
14-
IResourceGraph resourceGraph,
1513
IResourceService<Person> resourceService,
1614
ILoggerFactory loggerFactory)
17-
: base(jsonApiOptions, resourceGraph, resourceService, loggerFactory)
15+
: base(jsonApiOptions, resourceService, loggerFactory)
1816
{ }
1917
}
2018
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using JsonApiDotNetCore.Configuration;
22
using JsonApiDotNetCore.Controllers;
3-
using JsonApiDotNetCore.Internal.Contracts;
43
using JsonApiDotNetCore.Services;
54
using JsonApiDotNetCoreExample.Models;
65
using Microsoft.Extensions.Logging;
@@ -11,10 +10,9 @@ public class PersonRolesController : JsonApiController<PersonRole>
1110
{
1211
public PersonRolesController(
1312
IJsonApiOptions jsonApiOptions,
14-
IResourceGraph resourceGraph,
1513
IResourceService<PersonRole> resourceService,
1614
ILoggerFactory loggerFactory)
17-
: base(jsonApiOptions, resourceGraph, resourceService, loggerFactory)
15+
: base(jsonApiOptions, resourceService, loggerFactory)
1816
{ }
1917
}
2018
}

src/Examples/JsonApiDotNetCoreExample/Controllers/TodoCollectionsController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ public class TodoCollectionsController : JsonApiController<TodoItemCollection, G
1919

2020
public TodoCollectionsController(
2121
IJsonApiOptions jsonApiOptions,
22-
IResourceGraph resourceGraph,
2322
IDbContextResolver contextResolver,
2423
IResourceService<TodoItemCollection, Guid> resourceService,
2524
ILoggerFactory loggerFactory)
26-
: base(jsonApiOptions, resourceGraph, resourceService, loggerFactory)
25+
: base(jsonApiOptions, resourceService, loggerFactory)
2726
{
2827
_dbResolver = contextResolver;
2928
}

0 commit comments

Comments
 (0)