示例#1
0
        static IEnumerable <T> CastResultContent <T>(ProvisioningQueryResult result, ProvisioningQueryResultType expected)
        {
            if (result.Type != expected)
            {
                throw new InvalidCastException($"result type is {result.Type}");
            }

            // TODO: optimize this 2nd parse from JObject to target object type T
            return(result.Items.Select(o => ((JObject)o).ToObject <T>()));
        }
示例#2
0
        async Task <IEnumerable <T> > GetAndCastNextResultAsync <T>(ProvisioningQueryResultType type, QueryOptions options)
        {
            ProvisioningQueryResult r = await this.GetNextAsync(options);

            return(CastResultContent <T>(r, type));
        }