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

Commented Issue: Query composition error when derived type hides base type property [681]

$
0
0
If user define type like:<br />public class BaseType<br />{<br /> public string Name { get; set; }<br />}<br />public class DerivedType : BaseType<br />{<br /> public string Name { get; set; }<br />}<br />The derived type define a new property which has same name as base type but not override it.<br /><br />Model builder will throw following exception:<br /><br />System.InvalidOperationException occurred<br /> HResult=-2146233079<br /> Message=Sequence contains more than one element<br /> Source=System.Core<br /> StackTrace:<br /> at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)<br /> InnerException: <br />> System.Web.Http.OData.dll!System.Web.Http.OData.Builder.ODataConventionModelBuilder.RemoveBaseTypeProperties(System.Web.Http.OData.Builder.EntityTypeConfiguration derivedEntity, System.Web.Http.OData.Builder.EntityTypeConfiguration baseEntity) Line 276 + 0x87 bytes C#<br /> System.Web.Http.OData.dll!System.Web.Http.OData.Builder.ODataConventionModelBuilder.DiscoverInheritanceRelationships() Line 218 + 0xe bytes C#<br /> System.Web.Http.OData.dll!System.Web.Http.OData.Builder.ODataConventionModelBuilder.GetEdmModel() Line 171 + 0x8 bytes C#<br /> System.Web.Http.OData.dll!System.Web.Http.HttpActionDescriptorExtensions.GetEdmModel.AnonymousMethod__0(object _) Line 32 + 0xb bytes C#<br /> mscorlib.dll!System.Collections.Concurrent.ConcurrentDictionary<object,object>.GetOrAdd(object key, System.Func<object,object> valueFactory) + 0x49 bytes <br /> System.Web.Http.OData.dll!System.Web.Http.HttpActionDescriptorExtensions.GetEdmModel(System.Web.Http.Controllers.HttpActionDescriptor actionDescriptor, System.Type entityClrType) Line 27 + 0x67 bytes C#<br /> System.Web.Http.OData.dll!System.Web.Http.QueryableAttribute.CreateQueryContext(System.Type entityClrType, System.Web.Http.HttpConfiguration configuration, System.Web.Http.Controllers.HttpActionDescriptor actionDescriptor) Line 384 + 0xb bytes C#<br /> System.Web.Http.OData.dll!System.Web.Http.QueryableAttribute.ExecuteQuery(System.Collections.IEnumerable query, System.Net.Http.HttpRequestMessage request, System.Web.Http.HttpConfiguration configuration, System.Web.Http.Controllers.HttpActionDescriptor actionDescriptor) Line 346 + 0xe bytes C#<br /> System.Web.Http.OData.dll!System.Web.Http.QueryableAttribute.OnActionExecuted(System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext) Line 280 + 0x14 bytes C#<br /> WebStack.QA.Test.OData.dll!WebStack.QA.Test.OData.QueryComposition.ServerTypeTests.RunQueryableOnAllPossibleTypes(System.Type type, string queryString) Line 134 + 0xe bytes C#<br />
Comments: we can throw a better exception.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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