@@ -14,88 +14,82 @@ namespace Microsoft.OpenApi.OData.Operation
1414 /// </summary>
1515 internal class OperationHandlerProvider : IOperationHandlerProvider
1616 {
17- private IDictionary < ODataPathKind , IDictionary < OperationType , IOperationHandler > > _handlers ;
18-
19- /// <summary>
20- /// Initializes a new instance of <see cref="OperationHandlerProvider"/> class.
21- /// </summary>
22- public OperationHandlerProvider ( )
23- {
24- _handlers = new Dictionary < ODataPathKind , IDictionary < OperationType , IOperationHandler > > ( ) ;
17+ private readonly IDictionary < ODataPathKind , IDictionary < OperationType , IOperationHandler > > _handlers
18+ = new Dictionary < ODataPathKind , IDictionary < OperationType , IOperationHandler > > {
2519
2620 // entity set (Get/Post)
27- _handlers [ ODataPathKind . EntitySet ] = new Dictionary < OperationType , IOperationHandler >
21+ { ODataPathKind . EntitySet , new Dictionary < OperationType , IOperationHandler >
2822 {
2923 { OperationType . Get , new EntitySetGetOperationHandler ( ) } ,
3024 { OperationType . Post , new EntitySetPostOperationHandler ( ) }
31- } ;
25+ } } ,
3226
3327 // entity (Get/Patch/Delete)
34- _handlers [ ODataPathKind . Entity ] = new Dictionary < OperationType , IOperationHandler >
28+ { ODataPathKind . Entity , new Dictionary < OperationType , IOperationHandler >
3529 {
3630 { OperationType . Get , new EntityGetOperationHandler ( ) } ,
3731 { OperationType . Patch , new EntityPatchOperationHandler ( ) } ,
3832 { OperationType . Delete , new EntityDeleteOperationHandler ( ) }
39- } ;
33+ } } ,
4034
4135 // singleton (Get/Patch)
42- _handlers [ ODataPathKind . Singleton ] = new Dictionary < OperationType , IOperationHandler >
36+ { ODataPathKind . Singleton , new Dictionary < OperationType , IOperationHandler >
4337 {
4438 { OperationType . Get , new SingletonGetOperationHandler ( ) } ,
4539 { OperationType . Patch , new SingletonPatchOperationHandler ( ) }
46- } ;
40+ } } ,
4741
4842 // edm operation (Get|Post)
49- _handlers [ ODataPathKind . Operation ] = new Dictionary < OperationType , IOperationHandler >
43+ { ODataPathKind . Operation , new Dictionary < OperationType , IOperationHandler >
5044 {
5145 { OperationType . Get , new EdmFunctionOperationHandler ( ) } ,
5246 { OperationType . Post , new EdmActionOperationHandler ( ) }
53- } ;
47+ } } ,
5448
5549 // edm operation import (Get|Post)
56- _handlers [ ODataPathKind . OperationImport ] = new Dictionary < OperationType , IOperationHandler >
50+ { ODataPathKind . OperationImport , new Dictionary < OperationType , IOperationHandler >
5751 {
5852 { OperationType . Get , new EdmFunctionImportOperationHandler ( ) } ,
5953 { OperationType . Post , new EdmActionImportOperationHandler ( ) }
60- } ;
54+ } } ,
6155
6256 // navigation property (Get/Patch/Post/Delete)
63- _handlers [ ODataPathKind . NavigationProperty ] = new Dictionary < OperationType , IOperationHandler >
57+ { ODataPathKind . NavigationProperty , new Dictionary < OperationType , IOperationHandler >
6458 {
6559 { OperationType . Get , new NavigationPropertyGetOperationHandler ( ) } ,
6660 { OperationType . Patch , new NavigationPropertyPatchOperationHandler ( ) } ,
6761 { OperationType . Post , new NavigationPropertyPostOperationHandler ( ) } ,
6862 { OperationType . Delete , new NavigationPropertyDeleteOperationHandler ( ) }
69- } ;
63+ } } ,
7064
7165 // navigation property ref (Get/Post/Put/Delete)
72- _handlers [ ODataPathKind . Ref ] = new Dictionary < OperationType , IOperationHandler >
66+ { ODataPathKind . Ref , new Dictionary < OperationType , IOperationHandler >
7367 {
7468 { OperationType . Get , new RefGetOperationHandler ( ) } ,
7569 { OperationType . Put , new RefPutOperationHandler ( ) } ,
7670 { OperationType . Post , new RefPostOperationHandler ( ) } ,
7771 { OperationType . Delete , new RefDeleteOperationHandler ( ) }
78- } ;
72+ } } ,
7973
8074 // media entity operation (Get|Put)
81- _handlers [ ODataPathKind . MediaEntity ] = new Dictionary < OperationType , IOperationHandler >
75+ { ODataPathKind . MediaEntity , new Dictionary < OperationType , IOperationHandler >
8276 {
8377 { OperationType . Get , new MediaEntityGetOperationHandler ( ) } ,
8478 { OperationType . Put , new MediaEntityPutOperationHandler ( ) }
85- } ;
79+ } } ,
8680
8781 // $metadata operation (Get)
88- _handlers [ ODataPathKind . Metadata ] = new Dictionary < OperationType , IOperationHandler >
82+ { ODataPathKind . Metadata , new Dictionary < OperationType , IOperationHandler >
8983 {
9084 { OperationType . Get , new MetadataGetOperationHandler ( ) }
91- } ;
85+ } } ,
9286
9387 // $count operation (Get)
94- _handlers [ ODataPathKind . DollarCount ] = new Dictionary < OperationType , IOperationHandler >
88+ { ODataPathKind . DollarCount , new Dictionary < OperationType , IOperationHandler >
9589 {
9690 { OperationType . Get , new DollarCountGetOperationHandler ( ) }
97- } ;
98- }
91+ } } ,
92+ } ;
9993
10094 /// <inheritdoc/>
10195 public IOperationHandler GetHandler ( ODataPathKind pathKind , OperationType operationType )
0 commit comments