diff --git a/docs/usage/extensibility/services.md b/docs/usage/extensibility/services.md index 79fa7d8fb7..e14fb7c773 100644 --- a/docs/usage/extensibility/services.md +++ b/docs/usage/extensibility/services.md @@ -98,7 +98,7 @@ IResourceService │ └── IGetRelationshipsService | GET /{id}/relationships/{relationship} | -└── IResourceCmdService +└── IResourceCommandService | ├── ICreateService | POST / diff --git a/src/JsonApiDotNetCore/Builders/JsonApiApplicationBuilder.cs b/src/JsonApiDotNetCore/Builders/JsonApiApplicationBuilder.cs index d7b070f33a..c2ae694b64 100644 --- a/src/JsonApiDotNetCore/Builders/JsonApiApplicationBuilder.cs +++ b/src/JsonApiDotNetCore/Builders/JsonApiApplicationBuilder.cs @@ -135,7 +135,7 @@ public void ConfigureServices() _services.AddScoped(typeof(IResourceService<,>), typeof(DefaultResourceService<,>)); _services.AddScoped(typeof(IResourceQueryService<,>), typeof(DefaultResourceService<,>)); - _services.AddScoped(typeof(IResourceCmdService<,>), typeof(DefaultResourceService<,>)); + _services.AddScoped(typeof(IResourceCommandService<,>), typeof(DefaultResourceService<,>)); _services.AddSingleton(JsonApiOptions); _services.AddSingleton(resourceGraph); diff --git a/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs b/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs index c241c5b81d..551b781cc7 100644 --- a/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs +++ b/src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs @@ -48,17 +48,17 @@ public BaseJsonApiController( public BaseJsonApiController( IJsonApiOptions jsonApiOptions, IResourceQueryService queryService = null, - IResourceCmdService cmdService = null) + IResourceCommandService commandService = null) { _jsonApiOptions = jsonApiOptions; _getAll = queryService; _getById = queryService; _getRelationship = queryService; _getRelationships = queryService; - _create = cmdService; - _update = cmdService; - _updateRelationships = cmdService; - _delete = cmdService; + _create = commandService; + _update = commandService; + _updateRelationships = commandService; + _delete = commandService; } /// @@ -205,8 +205,8 @@ IResourceService resourceService public BaseJsonApiController( IJsonApiOptions jsonApiOptions, IResourceQueryService queryService = null, - IResourceCmdService cmdService = null - ) : base(jsonApiOptions, queryService, cmdService) { } + IResourceCommandService commandService = null + ) : base(jsonApiOptions, queryService, commandService) { } public BaseJsonApiController( diff --git a/src/JsonApiDotNetCore/Controllers/JsonApiCmdController.cs b/src/JsonApiDotNetCore/Controllers/JsonApiCommandController.cs similarity index 87% rename from src/JsonApiDotNetCore/Controllers/JsonApiCmdController.cs rename to src/JsonApiDotNetCore/Controllers/JsonApiCommandController.cs index d88ee0272d..b6705b4c49 100644 --- a/src/JsonApiDotNetCore/Controllers/JsonApiCmdController.cs +++ b/src/JsonApiDotNetCore/Controllers/JsonApiCommandController.cs @@ -6,20 +6,20 @@ namespace JsonApiDotNetCore.Controllers { - public class JsonApiCmdController : JsonApiCmdController + public class JsonApiCommandController : JsonApiCommandController where T : class, IIdentifiable { - public JsonApiCmdController( + public JsonApiCommandController( IJsonApiOptions jsonApiOptions, IResourceService resourceService) : base(jsonApiOptions, resourceService) { } } - public class JsonApiCmdController + public class JsonApiCommandController : BaseJsonApiController where T : class, IIdentifiable { - public JsonApiCmdController( + public JsonApiCommandController( IJsonApiOptions jsonApiOptions, IResourceService resourceService) : base(jsonApiOptions, resourceService) diff --git a/src/JsonApiDotNetCore/Graph/ServiceDiscoveryFacade.cs b/src/JsonApiDotNetCore/Graph/ServiceDiscoveryFacade.cs index b3c922e02e..ae3fef30f6 100644 --- a/src/JsonApiDotNetCore/Graph/ServiceDiscoveryFacade.cs +++ b/src/JsonApiDotNetCore/Graph/ServiceDiscoveryFacade.cs @@ -17,8 +17,8 @@ public class ServiceDiscoveryFacade : IServiceDiscoveryFacade internal static HashSet ServiceInterfaces = new HashSet { typeof(IResourceService<>), typeof(IResourceService<,>), - typeof(IResourceCmdService<>), - typeof(IResourceCmdService<,>), + typeof(IResourceCommandService<>), + typeof(IResourceCommandService<,>), typeof(IResourceQueryService<>), typeof(IResourceQueryService<,>), typeof(ICreateService<>), diff --git a/src/JsonApiDotNetCore/Services/Contract/IResourceCmdService.cs b/src/JsonApiDotNetCore/Services/Contract/IResourceCommandService.cs similarity index 74% rename from src/JsonApiDotNetCore/Services/Contract/IResourceCmdService.cs rename to src/JsonApiDotNetCore/Services/Contract/IResourceCommandService.cs index 0f6c5e64b7..252090b2d1 100644 --- a/src/JsonApiDotNetCore/Services/Contract/IResourceCmdService.cs +++ b/src/JsonApiDotNetCore/Services/Contract/IResourceCommandService.cs @@ -2,16 +2,16 @@ namespace JsonApiDotNetCore.Services { - public interface IResourceCmdService : + public interface IResourceCommandService : ICreateService, IUpdateService, IUpdateRelationshipService, IDeleteService, - IResourceCmdService + IResourceCommandService where T : class, IIdentifiable { } - public interface IResourceCmdService : + public interface IResourceCommandService : ICreateService, IUpdateService, IUpdateRelationshipService, diff --git a/src/JsonApiDotNetCore/Services/Contract/IResourceService.cs b/src/JsonApiDotNetCore/Services/Contract/IResourceService.cs index ec534a5f1b..0f221c4509 100644 --- a/src/JsonApiDotNetCore/Services/Contract/IResourceService.cs +++ b/src/JsonApiDotNetCore/Services/Contract/IResourceService.cs @@ -3,12 +3,12 @@ namespace JsonApiDotNetCore.Services { public interface IResourceService - : IResourceCmdService, IResourceQueryService, IResourceService + : IResourceCommandService, IResourceQueryService, IResourceService where T : class, IIdentifiable { } public interface IResourceService - : IResourceCmdService, IResourceQueryService + : IResourceCommandService, IResourceQueryService where T : class, IIdentifiable { } } diff --git a/test/UnitTests/Extensions/IServiceCollectionExtensionsTests.cs b/test/UnitTests/Extensions/IServiceCollectionExtensionsTests.cs index 7cae18b8df..2b9f3c2cb8 100644 --- a/test/UnitTests/Extensions/IServiceCollectionExtensionsTests.cs +++ b/test/UnitTests/Extensions/IServiceCollectionExtensionsTests.cs @@ -93,7 +93,7 @@ public void AddResourceService_Registers_All_Shorthand_Service_Interfaces() // Assert var provider = services.BuildServiceProvider(); Assert.IsType(provider.GetService(typeof(IResourceService))); - Assert.IsType(provider.GetService(typeof(IResourceCmdService))); + Assert.IsType(provider.GetService(typeof(IResourceCommandService))); Assert.IsType(provider.GetService(typeof(IResourceQueryService))); Assert.IsType(provider.GetService(typeof(IGetAllService))); Assert.IsType(provider.GetService(typeof(IGetByIdService))); @@ -116,7 +116,7 @@ public void AddResourceService_Registers_All_LongForm_Service_Interfaces() // Assert var provider = services.BuildServiceProvider(); Assert.IsType(provider.GetService(typeof(IResourceService))); - Assert.IsType(provider.GetService(typeof(IResourceCmdService))); + Assert.IsType(provider.GetService(typeof(IResourceCommandService))); Assert.IsType(provider.GetService(typeof(IResourceQueryService))); Assert.IsType(provider.GetService(typeof(IGetAllService))); Assert.IsType(provider.GetService(typeof(IGetByIdService)));