コード例 #1
0
        internal void Init(
            CosmosClientOptions clientOptions,
            DocumentClient documentClient)
        {
            this.ClientOptions  = clientOptions;
            this.DocumentClient = documentClient;

            //Request pipeline
            ClientPipelineBuilder clientPipelineBuilder = new ClientPipelineBuilder(
                this,
                this.ClientOptions.CustomHandlers);

            this.RequestHandler = clientPipelineBuilder.Build();

            CosmosSerializer userSerializer = this.ClientOptions.GetCosmosSerializerWithWrapperOrDefault();

            this.ResponseFactory = new CosmosResponseFactory(
                defaultJsonSerializer: this.ClientOptions.PropertiesSerializer,
                userJsonSerializer: userSerializer);

            CosmosSerializer sqlQuerySpecSerializer = CosmosSqlQuerySpecJsonConverter.CreateSqlQuerySpecSerializer(
                cosmosSerializer: userSerializer,
                propertiesSerializer: this.ClientOptions.PropertiesSerializer);

            this.ClientContext = new ClientContextCore(
                client: this,
                clientOptions: this.ClientOptions,
                userJsonSerializer: userSerializer,
                defaultJsonSerializer: this.ClientOptions.PropertiesSerializer,
                sqlQuerySpecSerializer: sqlQuerySpecSerializer,
                cosmosResponseFactory: this.ResponseFactory,
                requestHandler: this.RequestHandler,
                documentClient: this.DocumentClient);
        }
コード例 #2
0
 internal CosmosSerializerCore(
     CosmosSerializer customSerializer = null)
 {
     if (customSerializer == null)
     {
         this.customSerializer       = null;
         this.sqlQuerySpecSerializer = null;
     }
     else
     {
         this.customSerializer       = new CosmosJsonSerializerWrapper(customSerializer);
         this.sqlQuerySpecSerializer = CosmosSqlQuerySpecJsonConverter.CreateSqlQuerySpecSerializer(
             cosmosSerializer: this.customSerializer,
             propertiesSerializer: CosmosSerializerCore.propertiesSerializer);
     }
 }
コード例 #3
0
 internal CosmosSerializerCore(
     CosmosSerializer customSerializer = null)
 {
     if (customSerializer == null)
     {
         this.customSerializer = null;
         // this would allow us to set the JsonConverter and inturn handle Serialized/Stream Query Parameter Value.
         this.sqlQuerySpecSerializer = CosmosSqlQuerySpecJsonConverter.CreateSqlQuerySpecSerializer(
             cosmosSerializer: null,
             propertiesSerializer: CosmosSerializerCore.propertiesSerializer);
         this.patchOperationSerializer = null;
     }
     else
     {
         this.customSerializer       = new CosmosJsonSerializerWrapper(customSerializer);
         this.sqlQuerySpecSerializer = CosmosSqlQuerySpecJsonConverter.CreateSqlQuerySpecSerializer(
             cosmosSerializer: this.customSerializer,
             propertiesSerializer: CosmosSerializerCore.propertiesSerializer);
         this.patchOperationSerializer = PatchOperationsJsonConverter.CreatePatchOperationsSerializer(
             cosmosSerializer: this.customSerializer,
             propertiesSerializer: CosmosSerializerCore.propertiesSerializer);
     }
 }