Skip to content

Commit c9f5eb4

Browse files
author
Bart Koelman
authored
Renamed Cmd to Command in class names (#685)
From the start I found it strange to have Cmd (not Command) and Query (not Qry) next to each other. So I renamed Cmd to the full version for clarity and consistency.
1 parent 72e5064 commit c9f5eb4

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

docs/usage/extensibility/services.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ IResourceService
9898
│ └── IGetRelationshipsService
9999
| GET /{id}/relationships/{relationship}
100100
|
101-
└── IResourceCmdService
101+
└── IResourceCommandService
102102
|
103103
├── ICreateService
104104
| POST /

src/JsonApiDotNetCore/Builders/JsonApiApplicationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void ConfigureServices()
135135
_services.AddScoped(typeof(IResourceService<,>), typeof(DefaultResourceService<,>));
136136

137137
_services.AddScoped(typeof(IResourceQueryService<,>), typeof(DefaultResourceService<,>));
138-
_services.AddScoped(typeof(IResourceCmdService<,>), typeof(DefaultResourceService<,>));
138+
_services.AddScoped(typeof(IResourceCommandService<,>), typeof(DefaultResourceService<,>));
139139

140140
_services.AddSingleton<ILinksConfiguration>(JsonApiOptions);
141141
_services.AddSingleton(resourceGraph);

src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ public BaseJsonApiController(
4848
public BaseJsonApiController(
4949
IJsonApiOptions jsonApiOptions,
5050
IResourceQueryService<T, TId> queryService = null,
51-
IResourceCmdService<T, TId> cmdService = null)
51+
IResourceCommandService<T, TId> commandService = null)
5252
{
5353
_jsonApiOptions = jsonApiOptions;
5454
_getAll = queryService;
5555
_getById = queryService;
5656
_getRelationship = queryService;
5757
_getRelationships = queryService;
58-
_create = cmdService;
59-
_update = cmdService;
60-
_updateRelationships = cmdService;
61-
_delete = cmdService;
58+
_create = commandService;
59+
_update = commandService;
60+
_updateRelationships = commandService;
61+
_delete = commandService;
6262
}
6363

6464
/// <param name="jsonApiOptions"></param>
@@ -205,8 +205,8 @@ IResourceService<T, int> resourceService
205205
public BaseJsonApiController(
206206
IJsonApiOptions jsonApiOptions,
207207
IResourceQueryService<T, int> queryService = null,
208-
IResourceCmdService<T, int> cmdService = null
209-
) : base(jsonApiOptions, queryService, cmdService) { }
208+
IResourceCommandService<T, int> commandService = null
209+
) : base(jsonApiOptions, queryService, commandService) { }
210210

211211

212212
public BaseJsonApiController(

src/JsonApiDotNetCore/Controllers/JsonApiCmdController.cs renamed to src/JsonApiDotNetCore/Controllers/JsonApiCommandController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
namespace JsonApiDotNetCore.Controllers
88
{
9-
public class JsonApiCmdController<T> : JsonApiCmdController<T, int>
9+
public class JsonApiCommandController<T> : JsonApiCommandController<T, int>
1010
where T : class, IIdentifiable<int>
1111
{
12-
public JsonApiCmdController(
12+
public JsonApiCommandController(
1313
IJsonApiOptions jsonApiOptions,
1414
IResourceService<T, int> resourceService)
1515
: base(jsonApiOptions, resourceService)
1616
{ }
1717
}
1818

19-
public class JsonApiCmdController<T, TId>
19+
public class JsonApiCommandController<T, TId>
2020
: BaseJsonApiController<T, TId> where T : class, IIdentifiable<TId>
2121
{
22-
public JsonApiCmdController(
22+
public JsonApiCommandController(
2323
IJsonApiOptions jsonApiOptions,
2424
IResourceService<T, TId> resourceService)
2525
: base(jsonApiOptions, resourceService)

src/JsonApiDotNetCore/Graph/ServiceDiscoveryFacade.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class ServiceDiscoveryFacade : IServiceDiscoveryFacade
1717
internal static HashSet<Type> ServiceInterfaces = new HashSet<Type> {
1818
typeof(IResourceService<>),
1919
typeof(IResourceService<,>),
20-
typeof(IResourceCmdService<>),
21-
typeof(IResourceCmdService<,>),
20+
typeof(IResourceCommandService<>),
21+
typeof(IResourceCommandService<,>),
2222
typeof(IResourceQueryService<>),
2323
typeof(IResourceQueryService<,>),
2424
typeof(ICreateService<>),

src/JsonApiDotNetCore/Services/Contract/IResourceCmdService.cs renamed to src/JsonApiDotNetCore/Services/Contract/IResourceCommandService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace JsonApiDotNetCore.Services
44
{
5-
public interface IResourceCmdService<T> :
5+
public interface IResourceCommandService<T> :
66
ICreateService<T>,
77
IUpdateService<T>,
88
IUpdateRelationshipService<T>,
99
IDeleteService<T>,
10-
IResourceCmdService<T, int>
10+
IResourceCommandService<T, int>
1111
where T : class, IIdentifiable<int>
1212
{ }
1313

14-
public interface IResourceCmdService<T, in TId> :
14+
public interface IResourceCommandService<T, in TId> :
1515
ICreateService<T, TId>,
1616
IUpdateService<T, TId>,
1717
IUpdateRelationshipService<T, TId>,

src/JsonApiDotNetCore/Services/Contract/IResourceService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
namespace JsonApiDotNetCore.Services
44
{
55
public interface IResourceService<T>
6-
: IResourceCmdService<T>, IResourceQueryService<T>, IResourceService<T, int>
6+
: IResourceCommandService<T>, IResourceQueryService<T>, IResourceService<T, int>
77
where T : class, IIdentifiable<int>
88
{ }
99

1010
public interface IResourceService<T, in TId>
11-
: IResourceCmdService<T, TId>, IResourceQueryService<T, TId>
11+
: IResourceCommandService<T, TId>, IResourceQueryService<T, TId>
1212
where T : class, IIdentifiable<TId>
1313
{ }
1414
}

test/UnitTests/Extensions/IServiceCollectionExtensionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void AddResourceService_Registers_All_Shorthand_Service_Interfaces()
9393
// Assert
9494
var provider = services.BuildServiceProvider();
9595
Assert.IsType<IntResourceService>(provider.GetService(typeof(IResourceService<IntResource>)));
96-
Assert.IsType<IntResourceService>(provider.GetService(typeof(IResourceCmdService<IntResource>)));
96+
Assert.IsType<IntResourceService>(provider.GetService(typeof(IResourceCommandService<IntResource>)));
9797
Assert.IsType<IntResourceService>(provider.GetService(typeof(IResourceQueryService<IntResource>)));
9898
Assert.IsType<IntResourceService>(provider.GetService(typeof(IGetAllService<IntResource>)));
9999
Assert.IsType<IntResourceService>(provider.GetService(typeof(IGetByIdService<IntResource>)));
@@ -116,7 +116,7 @@ public void AddResourceService_Registers_All_LongForm_Service_Interfaces()
116116
// Assert
117117
var provider = services.BuildServiceProvider();
118118
Assert.IsType<GuidResourceService>(provider.GetService(typeof(IResourceService<GuidResource, Guid>)));
119-
Assert.IsType<GuidResourceService>(provider.GetService(typeof(IResourceCmdService<GuidResource, Guid>)));
119+
Assert.IsType<GuidResourceService>(provider.GetService(typeof(IResourceCommandService<GuidResource, Guid>)));
120120
Assert.IsType<GuidResourceService>(provider.GetService(typeof(IResourceQueryService<GuidResource, Guid>)));
121121
Assert.IsType<GuidResourceService>(provider.GetService(typeof(IGetAllService<GuidResource, Guid>)));
122122
Assert.IsType<GuidResourceService>(provider.GetService(typeof(IGetByIdService<GuidResource, Guid>)));

0 commit comments

Comments
 (0)