Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: Model builder allowing duplicate function names for Actions [469]

$
0
0
According to OData spec, we cannot have duplicate function names for Actions within a container. Notice that in the below example, the action "UpdateName" is present twice

"MUST not have a declaring EntityContainer that declares another FunctionImport with the same Name. This means that actions MUST NOT have overloads."

Model
--------
ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();
modelBuilder.ComplexType<Address>();
var products = modelBuilder.EntitySet<Product>("Products");
var productFamilies =modelBuilder.EntitySet<ProductFamily>("ProductFamilies");
var suppliers = modelBuilder.EntitySet<Supplier>("Suppliers");

var updateNameAction1 = products.EntityType.Action("UpdateName");
updateNameAction1.Parameter<string>("newName");

var updateNameAction2 = suppliers.EntityType.Action("UpdateName");
updateNameAction2.Parameter<string>("newName");

Metadata
-----------
<Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" Namespace="Default">
<EntityContainer Name="Container">
<EntitySet Name="Products" EntityType="ODataService.Models.Product"/>
<EntitySet Name="ProductFamilies" EntityType="ODataService.Models.ProductFamily"/>
<EntitySet Name="Suppliers" EntityType="ODataService.Models.Supplier"/>
<FunctionImport Name="UpdateName" IsBindable="true">
<Parameter Name="bindingParameter" Type="ODataService.Models.Product"/>
<Parameter Name="newName" Type="Edm.String" FixedLength="false" Unicode="false"/>
</FunctionImport>
<FunctionImport Name="UpdateName" IsBindable="true">
<Parameter Name="bindingParameter" Type="ODataService.Models.Supplier"/>
<Parameter Name="newName" Type="Edm.String" FixedLength="false" Unicode="false"/>
</FunctionImport>
Comments: The latest OData protocol actually allows action overloads that differ from binding parameters.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>