Skip to content

Commit abf67f0

Browse files
committed
feat(JsonApiController: Expose CQRS constructor
Closes #205
1 parent 1226747 commit abf67f0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/JsonApiDotNetCore/Controllers/JsonApiController.cs

+24
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ public JsonApiController(
1616
ILoggerFactory loggerFactory)
1717
: base(jsonApiContext, resourceService, loggerFactory)
1818
{ }
19+
20+
public JsonApiController(
21+
IJsonApiContext jsonApiContext,
22+
IGetAllService<T, int> getAll = null,
23+
IGetByIdService<T, int> getById = null,
24+
IGetRelationshipService<T, int> getRelationship = null,
25+
IGetRelationshipsService<T, int> getRelationships = null,
26+
ICreateService<T, int> create = null,
27+
IUpdateService<T, int> update = null,
28+
IUpdateRelationshipService<T, int> updateRelationships = null,
29+
IDeleteService<T, int> delete = null
30+
) : base(jsonApiContext, getAll, getById, getRelationship, getRelationships, create, update, updateRelationships, delete) { }
1931
}
2032

2133
public class JsonApiController<T, TId>
@@ -34,6 +46,18 @@ public JsonApiController(
3446
: base(jsonApiContext, resourceService)
3547
{ }
3648

49+
public JsonApiController(
50+
IJsonApiContext jsonApiContext,
51+
IGetAllService<T, TId> getAll = null,
52+
IGetByIdService<T, TId> getById = null,
53+
IGetRelationshipService<T, TId> getRelationship = null,
54+
IGetRelationshipsService<T, TId> getRelationships = null,
55+
ICreateService<T, TId> create = null,
56+
IUpdateService<T, TId> update = null,
57+
IUpdateRelationshipService<T, TId> updateRelationships = null,
58+
IDeleteService<T, TId> delete = null
59+
) : base(jsonApiContext, getAll, getById, getRelationship, getRelationships, create, update, updateRelationships, delete) { }
60+
3761
[HttpGet]
3862
public override async Task<IActionResult> GetAsync() => await base.GetAsync();
3963

0 commit comments

Comments
 (0)