internal void Init( CosmosClientOptions clientOptions, DocumentClient documentClient) { this.ClientOptions = clientOptions; this.DocumentClient = documentClient; //Request pipeline ClientPipelineBuilder clientPipelineBuilder = new ClientPipelineBuilder( this, this.DocumentClient.ResetSessionTokenRetryPolicy, this.ClientOptions.CustomHandlers); // DocumentClient is not initialized with any consistency overrides so default is backend consistency this.AccountConsistencyLevel = (ConsistencyLevel)this.DocumentClient.ConsistencyLevel; this.RequestHandler = clientPipelineBuilder.Build(); this.ResponseFactory = new CosmosResponseFactory( defaultJsonSerializer: this.ClientOptions.SettingsSerializer, userJsonSerializer: this.ClientOptions.CosmosSerializerWithWrapperOrDefault); CosmosClientContext clientContext = new CosmosClientContextCore( client: this, clientOptions: this.ClientOptions, userJsonSerializer: this.ClientOptions.CosmosSerializerWithWrapperOrDefault, defaultJsonSerializer: this.ClientOptions.SettingsSerializer, cosmosResponseFactory: this.ResponseFactory, requestHandler: this.RequestHandler, documentClient: this.DocumentClient, documentQueryClient: new DocumentQueryClient(this.DocumentClient)); this.Databases = new CosmosDatabasesCore(clientContext); this.offerSet = new Lazy <CosmosOffers>(() => new CosmosOffers(this.DocumentClient), LazyThreadSafetyMode.PublicationOnly); }
internal void Init( CosmosClientConfiguration configuration, DocumentClient documentClient) { this.Configuration = configuration; this.DocumentClient = documentClient; this.CosmosJsonSerializer = new CosmosJsonSerializerWrapper(this.Configuration.CosmosJsonSerializer); //Request pipeline ClientPipelineBuilder clientPipelineBuilder = new ClientPipelineBuilder( this, this.DocumentClient.ResetSessionTokenRetryPolicy, this.Configuration.CustomHandlers ); // DocumentClient is not initialized with any consistency overrides so default is backend consistency this.AccountConsistencyLevel = (ConsistencyLevel)this.DocumentClient.ConsistencyLevel; this.RequestHandler = clientPipelineBuilder.Build(); CosmosClientContext clientContext = new CosmosClientContextCore( this, this.Configuration, this.CosmosJsonSerializer, this.ResponseFactory, this.RequestHandler, this.DocumentClient, new DocumentQueryClient(this.DocumentClient)); this.Databases = new CosmosDatabasesCore(clientContext); this.offerSet = new Lazy <CosmosOffers>(() => new CosmosOffers(this.DocumentClient), LazyThreadSafetyMode.PublicationOnly); }