diff --git a/src/Microsoft.OData.Core/JsonLight/ODataJsonLightCollectionSerializer.cs b/src/Microsoft.OData.Core/JsonLight/ODataJsonLightCollectionSerializer.cs
index fbfa74b029..69e4a03ff7 100644
--- a/src/Microsoft.OData.Core/JsonLight/ODataJsonLightCollectionSerializer.cs
+++ b/src/Microsoft.OData.Core/JsonLight/ODataJsonLightCollectionSerializer.cs
@@ -50,6 +50,20 @@ internal void WriteCollectionStart(ODataCollectionStart collectionStart, IEdmTyp
// "@odata.context":...
this.WriteContextUriProperty(ODataPayloadKind.Collection, () => ODataContextUrlInfo.Create(collectionStart.SerializationInfo, itemTypeReference));
+ // "@odata.count":...
+ if (collectionStart.Count.HasValue)
+ {
+ this.JsonWriter.WriteInstanceAnnotationName(ODataAnnotationNames.ODataCount);
+ this.JsonWriter.WriteValue(collectionStart.Count.Value);
+ }
+
+ // "@odata.nextlink":...
+ if (collectionStart.NextPageLink != null)
+ {
+ this.JsonWriter.WriteInstanceAnnotationName(ODataAnnotationNames.ODataNextLink);
+ this.JsonWriter.WriteValue(this.UriToString(collectionStart.NextPageLink));
+ }
+
// "value":
this.JsonWriter.WriteValuePropertyName();
}
diff --git a/src/Microsoft.OData.Core/ODataCollectionStart.cs b/src/Microsoft.OData.Core/ODataCollectionStart.cs
index ce6d1305c6..a312bbd444 100644
--- a/src/Microsoft.OData.Core/ODataCollectionStart.cs
+++ b/src/Microsoft.OData.Core/ODataCollectionStart.cs
@@ -6,6 +6,8 @@
namespace Microsoft.OData.Core
{
+ using System;
+
///
/// OData representation of a top-level collection.
///
@@ -23,6 +25,22 @@ public string Name
get;
set;
}
+
+ /// Gets or sets the number of items in the feed.
+ /// The number of items in the feed.
+ public long? Count
+ {
+ get;
+ set;
+ }
+
+ /// Gets or sets the URI representing the next page link.
+ /// The URI representing the next page link.
+ public Uri NextPageLink
+ {
+ get;
+ set;
+ }
///
/// Provides additional serialization information to the for this .