|
13 | 13 | [CLSCompliant( false )]
|
14 | 14 | public static class ActionDescriptorExtensions
|
15 | 15 | {
|
16 |
| - const string VersionsAggregated = "MS_" + nameof( HasAggregatedVersions ); |
| 16 | + const string VersionPolicyIsAppliedKey = "MS_" + nameof( VersionPolicyIsApplied ); |
17 | 17 |
|
18 |
| - static bool HasAggregatedVersions( this ActionDescriptor action ) => action.Properties.GetOrDefault( VersionsAggregated, false ); |
| 18 | + static void VersionPolicyIsApplied( this ActionDescriptor action, bool value ) => action.Properties[VersionPolicyIsAppliedKey] = value; |
19 | 19 |
|
20 |
| - static void HasAggregatedVersions( this ActionDescriptor action, bool value ) => action.Properties[VersionsAggregated] = value; |
| 20 | + internal static bool VersionPolicyIsApplied( this ActionDescriptor action ) => action.Properties.GetOrDefault( VersionPolicyIsAppliedKey, false ); |
21 | 21 |
|
22 | 22 | internal static void AggregateAllVersions( this ActionDescriptor action, IEnumerable<ActionDescriptor> matchingActions )
|
23 | 23 | {
|
24 | 24 | Contract.Requires( action != null );
|
25 | 25 | Contract.Requires( matchingActions != null );
|
26 | 26 |
|
27 |
| - if ( action.HasAggregatedVersions() ) |
| 27 | + if ( action.VersionPolicyIsApplied() ) |
28 | 28 | {
|
29 | 29 | return;
|
30 | 30 | }
|
31 | 31 |
|
32 |
| - action.HasAggregatedVersions( true ); |
| 32 | + action.VersionPolicyIsApplied( true ); |
33 | 33 |
|
34 | 34 | var model = action.GetProperty<ApiVersionModel>();
|
35 | 35 | Contract.Assume( model != null );
|
36 | 36 |
|
37 | 37 | action.SetProperty( model.Aggregate( matchingActions.Select( a => a.GetProperty<ApiVersionModel>() ).Where( m => m != null ) ) );
|
38 | 38 | }
|
39 | 39 |
|
40 |
| - internal static void AggregateAllVersions( this ActionDescriptor action, ActionSelectionContext context ) |
41 |
| - { |
42 |
| - Contract.Requires( action != null ); |
43 |
| - Contract.Requires( context != null ); |
44 |
| - |
45 |
| - if ( action.HasAggregatedVersions() ) |
46 |
| - { |
47 |
| - return; |
48 |
| - } |
49 |
| - |
50 |
| - action.HasAggregatedVersions( true ); |
51 |
| - |
52 |
| - var model = action.GetProperty<ApiVersionModel>(); |
53 |
| - Contract.Assume( model != null ); |
54 |
| - |
55 |
| - action.SetProperty( model.Aggregate( context.AllVersions ) ); |
56 |
| - } |
57 |
| - |
58 | 40 | /// <summary>
|
59 | 41 | /// Returns a value indicating whether the provided action implicitly maps to the specified version.
|
60 | 42 | /// </summary>
|
|
0 commit comments