Beispiel #1
0
        public HttpClientSqlStreamStore(HttpClientSqlStreamStoreSettings settings)
        {
            if (settings.BaseAddress == null)
            {
                throw new ArgumentNullException(nameof(settings.BaseAddress));
            }

            if (!settings.BaseAddress.ToString().EndsWith("/"))
            {
                throw new ArgumentException("BaseAddress must end with /", nameof(settings.BaseAddress));
            }

            _httpClient = new HttpClient(settings.HttpMessageHandler)
            {
                BaseAddress           = settings.BaseAddress,
                DefaultRequestHeaders = { Accept = { new MediaTypeWithQualityHeaderValue("application/hal+json") } }
            };

            _streamStoreNotifier = new Lazy <IStreamStoreNotifier>(() =>
            {
                if (settings.CreateStreamStoreNotifier == null)
                {
                    throw new InvalidOperationException(
                        "Cannot create notifier because supplied createStreamStoreNotifier was null");
                }
                return(settings.CreateStreamStoreNotifier.Invoke(this));
            });
        }
        public HttpClientSqlStreamStore(HttpClientSqlStreamStoreSettings settings)
        {
            _settings            = settings;
            _streamStoreNotifier = new Lazy <IStreamStoreNotifier>(() =>
            {
                if (settings.CreateStreamStoreNotifier == null)
                {
                    throw new InvalidOperationException(
                        "Cannot create notifier because supplied createStreamStoreNotifier was null");
                }

                return(settings.CreateStreamStoreNotifier.Invoke(this));
            });
        }