Esempio n. 1
0
        private CosmosClient InitializeClient()
        {
            var options = new CosmosClientOptions
            {
                Serializer = new AuditCosmosSerializer()
            };

            if (CosmosClientOptionsAction != null)
            {
                CosmosClientOptionsAction.Invoke(options);
            }
            CosmosClient = new CosmosClient(EndpointBuilder?.Invoke(), AuthKeyBuilder?.Invoke(), options);
            return(CosmosClient);
        }
Esempio n. 2
0
        private IDocumentClient InitializeClient()
        {
            var policy = ConnectionPolicyBuilder?.Invoke()
                         ?? new ConnectionPolicy
            {
                ConnectionMode     = ConnectionMode.Direct,
                ConnectionProtocol = Protocol.Tcp
            };

            DocumentClient = new DocumentClient(new Uri(EndpointBuilder?.Invoke()), AuthKeyBuilder?.Invoke(), Configuration.JsonSettings, policy);
            Task.Run(() => { ((DocumentClient)DocumentClient).OpenAsync(); });

            return(DocumentClient);
        }
Esempio n. 3
0
        private IDocumentClient InitializeClient(AuditEvent auditEvent)
        {
            var policy = ConnectionPolicyBuilder?.Invoke(auditEvent)
                         ?? new ConnectionPolicy
            {
                ConnectionMode     = ConnectionMode.Direct,
                ConnectionProtocol = Protocol.Tcp
            };

            DocumentClient = new DocumentClient(new Uri(ConnectionStringBuilder?.Invoke(auditEvent)), AuthKeyBuilder?.Invoke(auditEvent), policy);
            Task.Run(() => { ((DocumentClient)DocumentClient).OpenAsync(); });

            return(DocumentClient);
        }