Closed
Description
tldr - In the OData example project I added a function with the same name to two different configurations. The examples can no longer run. I used to be able to add functions with the same name to two different OData endpoints without issue.
Example Repo - https://github.com/benhysell/aspnet-api-versioning
Example Project - https://github.com/benhysell/aspnet-api-versioning/tree/master/samples/aspnetcore/SwaggerODataSample
Using the examples I've duplicated the MostExpensive
function from Order
to Person
via the steps below to trigger the exception.
Steps to Reproduce
- Take the Example project
SwaggerODataSample
- Modify the configuration of PersonModelConfiguration.cs to add function
person.Collection.Function( "MostExpensive" ).ReturnsFromEntitySet<Person>( "People" );
https://github.com/benhysell/aspnet-api-versioning/blob/master/samples/aspnetcore/SwaggerODataSample/Configuration/PersonModelConfiguration.cs#L34 - Note this same function exists in the OrderModelConfiguration.cs -- https://github.com/benhysell/aspnet-api-versioning/blob/c29e95940cbaa66784b38f864ed51c60a9971d55/samples/aspnetcore/SwaggerODataSample/Configuration/OrderModelConfiguration.cs#L31
- Run the application
- Exception is thrown ODataRouteBuilderContext.cs ln 252
Is it allowable to have the same named function in two different models? And if not why not?