コード例 #1
0
 public static JToken SelectExpandJsonToken <T>(
     this ODataQuery <T> query,
     string selectText = null,
     string expandText = null,
     Action <JsonSerializer> configureSerializer = null,
     string entitySetName = null)
 {
     return(query.SelectExpand(selectText, expandText, entitySetName).ToJson(configureSerializer));
 }
コード例 #2
0
 public static void SelectExpandJson <T>(
     this ODataQuery <T> query,
     JsonWriter writer,
     string selectText = null,
     string expandText = null,
     Action <JsonSerializer> configureSerializer = null,
     string entitySetName = null)
 {
     query.SelectExpand(selectText, expandText, entitySetName).ToJson(writer, configureSerializer);
 }
        public static void SelectExpandJson <T>(
            this ODataQuery <T> query,
            JsonWriter writer,
            string selectText = null,
            string expandText = null,
            Action <JsonSerializer> configureSerializer = null,
            string entitySetName = null)
        {
            ISelectExpandWrapper[] result = query.SelectExpand(selectText, expandText, entitySetName).ToArray();

            JsonSerializer serializer = new JsonSerializer();

            configureSerializer?.Invoke(serializer);
            serializer.Converters.Add(new SelectExpandWrapperConverter());

            serializer.Serialize(writer, result);
        }