public DocumentDbRepository(string slot, IOptionsMonitor <DocumentDbOptions> options, ISafeLogger <DocumentDbRepository <T> > logger) { _reads = ReadAccessor.Create(typeof(T)); _writes = WriteAccessor.Create(typeof(T)); _slot = slot; _options = options; _logger = logger; var defaultSettings = new JsonSerializerSettings(); var documentDbOptions = options.Get(_slot); _client = new DocumentClient(EndpointUri, documentDbOptions.AccountKey, defaultSettings); _client2 = new CosmosClient(EndpointUri.ToString(), documentDbOptions.AccountKey, new CosmosClientOptions { AllowBulkExecution = true, ConnectionMode = ConnectionMode.Gateway, MaxRetryAttemptsOnRateLimitedRequests = 100 }); CreateDatabaseIfNotExistsAsync().Wait(); CreateCollectionIfNotExistsAsync().Wait(); }
/// <summary> /// Returns true if ComAdobeCqDtmReactorImplServiceWebServiceImplProperties instances are equal /// </summary> /// <param name="other">Instance of ComAdobeCqDtmReactorImplServiceWebServiceImplProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ComAdobeCqDtmReactorImplServiceWebServiceImplProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EndpointUri == other.EndpointUri || EndpointUri != null && EndpointUri.Equals(other.EndpointUri) ) && ( ConnectionTimeout == other.ConnectionTimeout || ConnectionTimeout != null && ConnectionTimeout.Equals(other.ConnectionTimeout) ) && ( SocketTimeout == other.SocketTimeout || SocketTimeout != null && SocketTimeout.Equals(other.SocketTimeout) )); }
public override int GetHashCode() { int result = EndpointUri.GetHashCode(); result = 29 * result + MessageName.GetHashCode(); result = 29 * result + CorrelationId.GetHashCode(); return(result); }
public bool Equals(SubscriptionInformation subscription) { if (subscription == null) { return(false); } if (!EndpointUri.Equals(subscription.EndpointUri)) { return(false); } if (!string.Equals(MessageName, subscription.MessageName)) { return(false); } if (!string.Equals(CorrelationId, subscription.CorrelationId)) { return(false); } return(true); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (EndpointUri != null) { hashCode = hashCode * 59 + EndpointUri.GetHashCode(); } if (ConnectionTimeout != null) { hashCode = hashCode * 59 + ConnectionTimeout.GetHashCode(); } if (SocketTimeout != null) { hashCode = hashCode * 59 + SocketTimeout.GetHashCode(); } return(hashCode); } }