Example #1
0
 public SanityClient(SanityOptions options, JsonSerializerSettings serializerSettings = null)
 {
     _options           = options;
     SerializerSettings = serializerSettings ?? new JsonSerializerSettings
     {
         ContractResolver  = new CamelCasePropertyNamesContractResolver(),
         NullValueHandling = NullValueHandling.Ignore,
         Converters        = new List <JsonConverter> {
             new SanityReferenceTypeConverter()
         }
     };
     Initialize();
 }
Example #2
0
 /// <summary>
 /// Create a new SanityDbContext using the specified options.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="isShared">Indicates that the context can be used by multiple SanityDocumentSets</param>
 public SanityDataContext(SanityOptions options, JsonSerializerSettings serializerSettings = null, SanityHtmlBuilderOptions htmlBuilderOptions = null, IHttpClientFactory clientFactory = null)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     SerializerSettings = serializerSettings ?? new JsonSerializerSettings
     {
         ContractResolver  = new CamelCasePropertyNamesContractResolver(),
         NullValueHandling = NullValueHandling.Ignore,
         Converters        = new List <JsonConverter> {
             new SanityReferenceTypeConverter()
         }
     };
     Client      = new SanityClient(options, serializerSettings, clientFactory);
     Mutations   = new SanityMutationBuilder(Client);
     HtmlBuilder = new SanityHtmlBuilder(options, null, SerializerSettings, htmlBuilderOptions);
 }
Example #3
0
 /// <summary>
 /// Create a new SanityDbContext using the specified options.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="isShared">Indicates that the context can be used by multiple SanityDocumentSets</param>
 internal SanityDataContext(SanityOptions options, bool isShared) : this(options)
 {
     IsShared = isShared;
 }