I may be missing some context on why it is done this way, but the GetEntries<T> method in ContentfulClient.cs deserializes the $.items property twice, impacting performance.
The section of the code that I am referring to is:
entries = json.SelectToken("$.items").ToObject<IEnumerable<T>>(Serializer);var collection = json.ToObject<ContentfulCollection<T>>(Serializer);collection.Items = entries;
The list of entries is first deserialized by specifying the $.items property, however, the whole JSON ( including all $items objects) is deserialized again on the next line.
@orlando-popescu this is true, I removed the superflous call and ran through all tests and it is just a complete oversight. Thank you for noticing, it'll improve performance slightly for the next release.
I may be missing some context on why it is done this way, but the
GetEntries<T>
method inContentfulClient.cs
deserializes the$.items
property twice, impacting performance.The section of the code that I am referring to is:
entries = json.SelectToken("$.items").ToObject<IEnumerable<T>>(Serializer);
var collection = json.ToObject<ContentfulCollection<T>>(Serializer);
collection.Items = entries;
The list of entries is first deserialized by specifying the
$.items
property, however, the whole JSON ( including all$items
objects) is deserialized again on the next line.