keenlabs / keen-sdk-net

A .NET SDK for the Keen IO API
MIT License
37 stars 24 forks source link

Double Parsing in Datasets impl #131

Open masojus opened 6 years ago

masojus commented 6 years ago

Take a look at the methods that are parsing once to check error conditions and parsing again afterward to get the actual response object. From review comments:

Here and elsewhere it might be nice to avoid parsing twice. Here we JObject.Parse() and then a few lines later unless there's an error condition, we JsonConvert.DeserializeObject<>(). I wonder if either by messing with MissingMemberHandling when deserializing, so that if it's an error object we still get the error info, or by using JObject.ToObject<>() after error checking we can do this without doing two full string parsing steps.