예제 #1
0
 private Session(Uri baseUri, string metadataString)
 {
     this.Settings = new ODataClientSettings {
         BaseUri = baseUri
     };
     this.MetadataCache = MetadataCache.GetOrAdd(baseUri.AbsoluteUri, uri => new MetadataCache(uri, metadataString));
 }
예제 #2
0
        public async Task <IODataAdapter> ResolveAdapterAsync(CancellationToken cancellationToken)
        {
            if (this.MetadataCache == null)
            {
                this.MetadataCache =
                    MetadataCache.GetOrAdd(
                        this.Settings.BaseUri.AbsoluteUri,
                        uri =>
                {
                    var cache = new MetadataCache(uri);
                    cache.SetMetadataDocument(ResolveMetadataAsync(cancellationToken));

                    return(cache);
                });
            }

            await this.MetadataCache.Resolved;

            if (this.Settings.PayloadFormat == ODataPayloadFormat.Unspecified)
            {
                this.Settings.PayloadFormat = this.Adapter.DefaultPayloadFormat;
            }

            return(this.Adapter);
        }
예제 #3
0
 private Session(Uri baseUri, string metadataString)
 {
     this.Settings         = new ODataClientSettings();
     this.Settings.BaseUri = baseUri;
     this.MetadataCache    = MetadataCache.GetOrAdd(baseUri.AbsoluteUri, uri => new MetadataCache(uri, metadataString));
     this.Pluralizer       = new SimplePluralizer();
 }