Skip to content

Commit 3d4a977

Browse files
authored
Fix GetOrCreateObject Update Copyright date range (#88)
* Fix GetOrCreateObject Update Copyright date range GetOrCreateObject did not add any data to the database Copyright updated form 2019 to 2021 to 2019 to 2022 Update formatting Use auto Null parameter check where possible i.e. key!! * Clean up code Use more expression bodies where possible
1 parent e2aa403 commit 3d4a977

File tree

27 files changed

+120
-270
lines changed

27 files changed

+120
-270
lines changed

src/ReactiveMarbles.CacheData.SystemTextJson/SystemJsonSerializer.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

5-
using System;
65
using System.Text.Json;
7-
using System.Text.Json.Serialization;
8-
96
using ReactiveMarbles.CacheDatabase.Core;
107

118
namespace ReactiveMarbles.CacheDatabase.SystemTextJson

src/ReactiveMarbles.CacheDatabase.Benchmarks/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

src/ReactiveMarbles.CacheDatabase.Benchmarks/Utility.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

55
using System;
6-
using System.Collections.Generic;
76
using System.IO;
8-
using System.Linq;
97
using System.Reactive.Disposables;
10-
using System.Text;
118
using System.Threading;
12-
using System.Threading.Tasks;
139

1410
namespace ReactiveMarbles.CacheDatabase.Benchmarks
1511
{

src/ReactiveMarbles.CacheDatabase.Core/CoreRegistrations.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

5-
using System;
6-
using System.Collections.Generic;
75
using System.Reactive.Concurrency;
8-
using System.Text;
96

107
namespace ReactiveMarbles.CacheDatabase.Core
118
{

src/ReactiveMarbles.CacheDatabase.Core/HttpExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

src/ReactiveMarbles.CacheDatabase.Core/HttpService.cs

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

@@ -48,15 +48,8 @@ public HttpService()
4848
/// <param name="fetchAlways">Force a web request to always be issued, skipping the cache.</param>
4949
/// <param name="absoluteExpiration">An optional expiration date.</param>
5050
/// <returns>The data downloaded from the URL.</returns>
51-
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, string url, HttpMethod? method = default, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
52-
{
53-
if (blobCache is null)
54-
{
55-
throw new ArgumentNullException(nameof(blobCache));
56-
}
57-
58-
return blobCache.DownloadUrl(url, url, method, headers, fetchAlways, absoluteExpiration);
59-
}
51+
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache!!, string url, HttpMethod? method = default, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null) =>
52+
blobCache.DownloadUrl(url, url, method, headers, fetchAlways, absoluteExpiration);
6053

6154
/// <summary>
6255
/// Download data from an HTTP URL and insert the result into the
@@ -71,20 +64,9 @@ public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, string url, HttpMet
7164
/// <param name="fetchAlways">Force a web request to always be issued, skipping the cache.</param>
7265
/// <param name="absoluteExpiration">An optional expiration date.</param>
7366
/// <returns>The data downloaded from the URL.</returns>
74-
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, Uri url, HttpMethod? method = default, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
75-
{
76-
if (blobCache is null)
77-
{
78-
throw new ArgumentNullException(nameof(blobCache));
79-
}
80-
81-
if (url is null)
82-
{
83-
throw new ArgumentNullException(nameof(url));
84-
}
85-
86-
return blobCache.DownloadUrl(url.ToString(), url, method, headers, fetchAlways, absoluteExpiration);
87-
}
67+
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache!!, Uri url, HttpMethod? method = default, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null) => url is null
68+
? throw new ArgumentNullException(nameof(url))
69+
: blobCache.DownloadUrl(url.ToString(), url, method, headers, fetchAlways, absoluteExpiration);
8870

8971
/// <summary>
9072
/// Download data from an HTTP URL and insert the result into the
@@ -186,9 +168,7 @@ protected virtual IObservable<HttpResponseMessage> MakeWebRequest(
186168
int retries = 3,
187169
TimeSpan? timeout = null)
188170
{
189-
IObservable<HttpResponseMessage> request;
190-
191-
request = Observable.Defer(() =>
171+
var request = Observable.Defer(() =>
192172
{
193173
var httpRequest = CreateWebRequest(uri, method, headers);
194174

src/ReactiveMarbles.CacheDatabase.Core/IBlobCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

src/ReactiveMarbles.CacheDatabase.Core/IHttpService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

55
using System;
66
using System.Collections.Generic;
77
using System.Net.Http;
8-
using System.Text;
98

109
namespace ReactiveMarbles.CacheDatabase.Core
1110
{

src/ReactiveMarbles.CacheDatabase.Core/ISecureBlobCache.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

5-
using System;
6-
using System.Collections.Generic;
7-
using System.Text;
8-
95
namespace ReactiveMarbles.CacheDatabase.Core
106
{
117
/// <summary>

src/ReactiveMarbles.CacheDatabase.Core/ISerializer.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
1+
// Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
22
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for full license information.
44

5-
using System;
6-
using System.Collections.Generic;
7-
using System.Text;
8-
95
namespace ReactiveMarbles.CacheDatabase.Core
106
{
117
/// <summary>

0 commit comments

Comments
 (0)