static void Main(string[] args) { var ct = new CancellationToken(); var cfg = new LazyLoadingConfiguration(10000, ct); var engine = new CloudRequestEngineBuilder(_loggerFactory, _httpClient) .SetEndPoint("https://cloud.51degrees.com/api/v4/json") // Obtain a resource key from https://configure.51degrees.com .SetResourceKey("AQS5HKcyHJbECm6E10g") .SetLazyLoading(cfg) .Build(); using (var pipeline = new PipelineBuilder(_loggerFactory).AddFlowElement(engine).Build()) { var data = pipeline.CreateFlowData(); data.AddEvidence("query.User-Agent", "iPhone"); data.Process(); var result = data.GetFromElement(engine).JsonResponse; Console.WriteLine(result); } Console.ReadKey(); }
/// <summary> /// Configure lazy loading of results. /// </summary> /// <param name="timeoutMs"> /// The timeout length in milliseconds. /// </param> /// <returns> /// This engine builder instance. /// </returns> public TBuilder SetLazyLoadingTimeout(int timeoutMs) { if (_lazyLoadingConfig == null) { _lazyLoadingConfig = new LazyLoadingConfiguration(); } _lazyLoadingConfig.PropertyTimeoutMs = timeoutMs; return(this as TBuilder); }
/// <summary> /// Configure lazy loading of results. /// </summary> /// <param name="lazyLoadingConfig"> /// The configuration to use. /// </param> /// <returns> /// This engine builder instance. /// </returns> public TBuilder SetLazyLoading(LazyLoadingConfiguration lazyLoadingConfig) { _lazyLoadingConfig = lazyLoadingConfig; return(this as TBuilder); }
/// <summary> /// Configure lazy loading of results. /// </summary> /// <param name="configuration"> /// The configuration to use. /// </param> /// <returns> /// This engine builder instance. /// </returns> public virtual void SetLazyLoading(LazyLoadingConfiguration configuration) { LazyLoadingConfiguration = configuration; }