public static void ApplyOptions(this NewtonsoftJsonJsonSerializer jsonSerializer, CreateSerializerOptions options) { if (options == null) { return; } if (options.TypeNameHandling.HasValue) { switch (options.TypeNameHandling) { case TypeNameHandling.None: jsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.None; break; case TypeNameHandling.Objects: jsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Objects; break; } } }
public static void ApplyOptions(this NewtonsoftJsonJsonSerializer jsonSerializer, CreateSerializerOptions options) { switch (options?.TypeNameHandling) { case TypeNameHandling.None: jsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.None; break; case TypeNameHandling.Objects: jsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Objects; break; case TypeNameHandling.Auto: jsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Auto; break; } }