Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Asp.Versioning.ApplicationModels;

using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.OData.Edm;
using Microsoft.AspNetCore.OData.Routing.Attributes;

/// <summary>
Expand All @@ -16,7 +17,7 @@ public bool IsSatisfiedBy( ControllerModel controller )
{
ArgumentNullException.ThrowIfNull( controller );

if ( ODataControllerSpecification.IsSatisfiedBy( controller ) )
if ( Matches( controller ) )
{
return true;
}
Expand All @@ -25,7 +26,7 @@ public bool IsSatisfiedBy( ControllerModel controller )

for ( var i = 0; i < actions.Count; i++ )
{
if ( IsSatisfiedBy( actions[i] ) )
if ( Matches( actions[i] ) )
{
return true;
}
Expand All @@ -34,7 +35,7 @@ public bool IsSatisfiedBy( ControllerModel controller )
return false;
}

internal static bool IsSatisfiedBy( ICommonModel model )
internal static bool Matches( ICommonModel model )
{
var attributes = model.Attributes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private static
CollateApiVersions( ApplicationModel application )
{
var controllers = application.Controllers;
var specification = new ODataControllerSpecification();
var metadataControllers = default( List<ControllerModel> );
var supported = default( SortedSet<ApiVersion> );
var deprecated = default( SortedSet<ApiVersion> );
Expand All @@ -93,7 +94,7 @@ private static
metadataControllers.Add( controller );
continue;
}
else if ( !ODataControllerSpecification.IsSatisfiedBy( controller ) )
else if ( !specification.IsSatisfiedBy( controller ) )
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ public override bool AppliesToAction( ODataControllerActionContext context )

private static bool IsODataController( ODataControllerActionContext context )
{
if ( ODataControllerSpecification.IsSatisfiedBy( context.Controller ) )
if ( ODataControllerSpecification.Matches( context.Controller ) )
{
return true;
}

return ODataControllerSpecification.IsSatisfiedBy( context.Action );
return ODataControllerSpecification.Matches( context.Action );
}

private static IEdmModel? FindModel( ODataControllerActionContext context )
Expand Down
Loading