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

Edited Issue: Error writing out response when certain link generators return no link(null) [502]

$
0
0
Scenario1<br />------------<br />In this scenario, I would like to make a read-only entityset for Products. I am commenting out the line which creates the Edit link. This is from the ODataService sample.<br /><br />ODataModelBuilder modelBuilder = new ODataModelBuilder();<br />var products = modelBuilder.EntitySet<Product>("Products");<br />//products.HasEditLink(entityContext => entityContext.UrlHelper.Link(ODataRouteNames.GetById, new { controller = "Products", id = entityContext.EntityInstance.ID }));<br /><br />For the following request:<br />GET http://kirandesktop:50231/Products(49)<br /><br />I am seeing the following exception in the formatter write:<br /><br />No EditLink factory was found. Try calling HasEditLink on the EntitySetConfiguration for 'Products'.<br /><br />System.InvalidOperationException occurred<br /> HResult=-2146233079<br /> Message=No EditLink factory was found. Try calling HasEditLink on the EntitySetConfiguration for 'Products'.<br /> Source=System.Web.Http.OData<br /> StackTrace:<br /> at System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildEditLink(EntityInstanceContext context) in d:\Runtime\src\System.Web.Http.OData\OData\Builder\EntitySetLinkBuilderAnnotation.cs:line 88<br /> InnerException:<br /><br /><br />Scenario2<br />-----------<br />- I am receiving errors for the following[1] Has<>Link actions…a scenario for HasEditLink is that, a user might want to show edit links only for specific instances, let’s say based on some criteria… I do not see much use case as to when a user would not want to generate an Feed link though…<br />- These[2] work fine…I do not see much use case as to when a user would not want to generate an Id link though…<br />- For this[3], I am seeing that the links are still being generated…<br /><br />static IEdmModel GetImplicitEdmModel()<br /> {<br /> ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();<br /> var products = modelBuilder.EntitySet<Product>("Products");<br /> modelBuilder.Entity<RatedProduct>().DerivesFrom<Product>();<br /> var productFamilies = modelBuilder.EntitySet<ProductFamily>("ProductFamilies");<br /> var suppliers = modelBuilder.EntitySet<Supplier>("Suppliers");<br /><br /> ActionConfiguration createProduct = modelBuilder.Entity<ProductFamily>().Action("CreateProduct");<br /> createProduct.Parameter<string>("Name");<br /> createProduct.Returns<int>();<br /><br /> var extendSupportDate = modelBuilder.Entity<Product>().TransientAction("ExtendSupportDate");<br /> extendSupportDate.Parameter<DateTime>("newDate");<br /> extendSupportDate.ReturnsCollectionFromEntitySet<Product>("Products");<br /><br />[1]<br />---------------------------------------------<br /> extendSupportDate.HasActionLink(eic =><br /> {<br /> return null;<br /> });<br /><br /> products.HasIdLink(eic =><br /> {<br /> return (string)null;<br /> });<br /><br />[2]<br />--------------------------------------<br /> products.HasEditLink(eic =><br /> {<br /> return (string)null;<br /> });<br /><br /> products.HasFeedSelfLink(fc =><br /> {<br /> return (string)null;<br /> });<br /><br />products.HasReadLink(eic =><br /> {<br /> return (string)null;<br /> });<br /><br />[3]<br />----------------------------------------------------<br /> products.HasNavigationPropertiesLink(<br /> products.EntityType.NavigationProperties,<br /> (entityContext, navigationProperty) =><br /> {<br /> return null;<br /> });<br />

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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