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); }
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); }
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); }