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

Closed Issue: odata.type annotation not being included in the payload when querying for an entry or a feed in full metadata [781]

$
0
0
Scenario:

I've created a model with a BaseEntity and a DerivedEntity. I query for a feed of entries that contains both, base entities and derived entities in full metadata. The odata.type annotation only shows for the derived entities when it would need to appear for all of them.

Request:

GET http://localhost:5000/ODataType/BaseEntity/ HTTP/1.1
Accept: application/json; odata=fullmetadata
Host: localhost:5000
Connection: Keep-Alive

Response:

HTTP/1.1 200 OK
Content-Length: 1612
Content-Type: application/json; odata=fullmetadata; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0
Date: Thu, 17 Jan 2013 23:40:36 GMT

{
"odata.metadata":"http://localhost:5000/ODataType/$metadata#BaseEntity","value":[
{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(0)","Id":0
},{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(1)","Id":1
},{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(2)","Id":2
},{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(3)","Id":3
},{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(4)","Id":4
},{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(5)","Id":5
},{
"odata.id":"http://localhost:5000/ODataType/BaseEntity(6)","Id":6
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(7)","Id":7
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(8)","Id":8
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(9)","Id":9
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(10)","Id":10
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(11)","Id":11
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(12)","Id":12
},{
"odata.type":"ODataTypeRepro.Models.DerivedEntity","odata.id":"http://localhost:5000/ODataType/BaseEntity(13)","Id":13
}
]
}

Metadata document:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="3.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="ODataTypeRepro.Models" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="BaseEntity">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
</EntityType>
<EntityType Name="DerivedEntity" BaseType="ODataTypeRepro.Models.BaseEntity" />
</Schema>
<Schema Namespace="Default" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
<EntitySet Name="BaseEntity" EntityType="ODataTypeRepro.Models.BaseEntity" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Repro steps:

1) Unzip the repro project.
2) Restore nugget packages.
3) Point the System.Web.Http.Odata.dll to your product code dll.
4) Run the project.
Comments: Verified with a test

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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