Skip to content

Commit 428b036

Browse files
Normalize OData endpoint metadata regardless of EDM count. Fixes #850
1 parent 109430f commit 428b036

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/AspNetCore/OData/src/Asp.Versioning.OData/OData/ODataMultiModelApplicationModelProvider.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,12 @@ static void NoConfig( IServiceCollection sc )
116116
// 2. OData adds a SelectorModel per EDM
117117
// 3. ApiVersionMetadata has already be computed and added to EndpointMetadata
118118
//
119-
// this only becomes a problem when there are multiple EDMs and a single action implementation
120-
// maps to more than one EDM.
119+
// this becomes a problem when there are multiple EDMs and a single action implementation
120+
// maps to more than one EDM or a dynamically added OData endpoint is added without ApiVersionMetadata.
121121
//
122122
// REF: https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.Core/src/ApplicationModels/ActionAttributeRouteModel.cs
123123
// REF: https://github.com/OData/AspNetCoreOData/blob/main/src/Microsoft.AspNetCore.OData/Extensions/ActionModelExtensions.cs#L148
124-
if ( mapping.Count > 1 )
125-
{
126-
CopyApiVersionEndpointMetadata( context.Result.Controllers );
127-
}
124+
CopyApiVersionEndpointMetadata( context.Result.Controllers );
128125

129126
versionedODataOptions.Mapping = mapping;
130127
}

0 commit comments

Comments
 (0)