Scenario:
1) I've created an entity with a property that has a collection of integers.
2) I query for the feed in full metadata.
3) The odata.type annotation doesn't appear for the property in the payload.
4) As collections are not heuristically inferrable they odata.type annotation should appear on the payload for any collection property in full metadata.
Request:
GET http://localhost:5000/Collections/EntityWithCollection/ HTTP/1.1
Accept: application/json; odata=fullmetadata
Host: localhost:5000
Connection: Keep-Alive
Response:
HTTP/1.1 200 OK
Content-Length: 1606
Content-Type: application/json; odata=fullmetadata; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0
Date: Fri, 18 Jan 2013 19:39:08 GMT
{
"odata.metadata":"http://localhost:5000/Collections/$metadata#EntityWithCollection","value":[
{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(0)","CollectionProperty":[
0,1,2,3,4
],"Id":0
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(1)","CollectionProperty":[
10,11,12,13,14
],"Id":1
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(2)","CollectionProperty":[
20,21,22,23,24
],"Id":2
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(3)","CollectionProperty":[
30,31,32,33,34
],"Id":3
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(4)","CollectionProperty":[
40,41,42,43,44
],"Id":4
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(5)","CollectionProperty":[
50,51,52,53,54
],"Id":5
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(6)","CollectionProperty":[
60,61,62,63,64
],"Id":6
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(7)","CollectionProperty":[
70,71,72,73,74
],"Id":7
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(8)","CollectionProperty":[
80,81,82,83,84
],"Id":8
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(9)","CollectionProperty":[
90,91,92,93,94
],"Id":9
}
]
}
Metadata:
<?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="ODataTypeForCollectionsRepro.Models" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="EntityWithCollection">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="CollectionProperty" Type="Collection(Edm.Int32)" Nullable="false" />
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
</EntityType>
</Schema>
<Schema Namespace="Default" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
<EntitySet Name="EntityWithCollection" EntityType="ODataTypeForCollectionsRepro.Models.EntityWithCollection" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Repro steps:
1) Open the project as Administrator.
2) Restore nugget packages.
3) Point System.Web.Http.Odata.dll to your product code dll.
4) Run
1) I've created an entity with a property that has a collection of integers.
2) I query for the feed in full metadata.
3) The odata.type annotation doesn't appear for the property in the payload.
4) As collections are not heuristically inferrable they odata.type annotation should appear on the payload for any collection property in full metadata.
Request:
GET http://localhost:5000/Collections/EntityWithCollection/ HTTP/1.1
Accept: application/json; odata=fullmetadata
Host: localhost:5000
Connection: Keep-Alive
Response:
HTTP/1.1 200 OK
Content-Length: 1606
Content-Type: application/json; odata=fullmetadata; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0
Date: Fri, 18 Jan 2013 19:39:08 GMT
{
"odata.metadata":"http://localhost:5000/Collections/$metadata#EntityWithCollection","value":[
{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(0)","CollectionProperty":[
0,1,2,3,4
],"Id":0
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(1)","CollectionProperty":[
10,11,12,13,14
],"Id":1
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(2)","CollectionProperty":[
20,21,22,23,24
],"Id":2
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(3)","CollectionProperty":[
30,31,32,33,34
],"Id":3
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(4)","CollectionProperty":[
40,41,42,43,44
],"Id":4
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(5)","CollectionProperty":[
50,51,52,53,54
],"Id":5
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(6)","CollectionProperty":[
60,61,62,63,64
],"Id":6
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(7)","CollectionProperty":[
70,71,72,73,74
],"Id":7
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(8)","CollectionProperty":[
80,81,82,83,84
],"Id":8
},{
"odata.id":"http://localhost:5000/Collections/EntityWithCollection(9)","CollectionProperty":[
90,91,92,93,94
],"Id":9
}
]
}
Metadata:
<?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="ODataTypeForCollectionsRepro.Models" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="EntityWithCollection">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="CollectionProperty" Type="Collection(Edm.Int32)" Nullable="false" />
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
</EntityType>
</Schema>
<Schema Namespace="Default" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
<EntitySet Name="EntityWithCollection" EntityType="ODataTypeForCollectionsRepro.Models.EntityWithCollection" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Repro steps:
1) Open the project as Administrator.
2) Restore nugget packages.
3) Point System.Web.Http.Odata.dll to your product code dll.
4) Run