/// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     News     = new NewsOperations(this);
     BaseUri  = "{Endpoint}/bing/v7.0";
     Endpoint = "https://api.cognitive.microsoft.com";
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ResponseBase>("_type"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <ResponseBase>("_type"));
     CustomInitialize();
 }
Esempio n. 2
0
 public NewsController(ICurrentUserProvider currentUserProvider, INewsOperations newsOperations) : base(currentUserProvider)
 {
     _newsOperations = newsOperations;
 }