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

Edited Issue: Throw error when user registers entity type as returntype without entityset [518]

$
0
0
In the following example, the action "ExtendSupportDate" has a return type of Product which is actually an entity type. Currently the Edmmodel generates without an error. We should throw an indicating that if a user is returning an entity type, they should always associate with an EntitySet.

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

var config = products.EntityType.Action("ExtendSupportDate");
config.Parameter<DateTime>("newDate");
config.Returns<Product>();

Metadata generated:
----------------------
<FunctionImport Name="ExtendSupportDate" ReturnType="ODataService.Models.Product" IsBindable="true">
<Parameter Name="bindingParameter" Type="ODataService.Models.Product"/>
<Parameter Name="newDate" Type="Edm.DateTime"/>
</FunctionImport>

This is a negative case and also there are comments on this API. Users could use api like ReturnsFromEntitySet or ReturnsCollectionFromEntitySet to avoid the problem here.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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