From 445b500716eaf205594289d870e8b85af9385f31 Mon Sep 17 00:00:00 2001 From: Glenn <5834289+glennawatson@users.noreply.github.com> Date: Fri, 22 Jan 2021 10:11:57 +0000 Subject: [PATCH] feature: Update to .net 5 (#646) --- src/Akavache.Core/Akavache.Core.csproj | 4 +- .../BlobCache/InMemoryBlobCache.cs | 36 ++- src/Akavache.Core/BulkOperationsMixin.cs | 10 +- src/Akavache.Core/DependencyResolverMixin.cs | 15 +- .../Json/JsonDateTimeContractResolver.cs | 2 +- .../Json/JsonDateTimeOffsetTickConverter.cs | 2 +- .../Json/JsonDateTimeTickConverter.cs | 4 +- .../Json/JsonSerializationMixin.cs | 35 ++- .../KeyedOperations/KeyedOperationQueue.cs | 29 +- .../Platforms/shared/AkavacheHttpMixin.cs | 8 +- .../Platforms/shared/Registrations.cs | 3 +- src/Akavache.Core/Platforms/shared/Utility.cs | 17 +- .../Akavache.CosmosDB.csproj | 2 +- src/Akavache.Drawing/Akavache.Drawing.csproj | 4 +- src/Akavache.Drawing/BitmapImageMixin.cs | 2 +- src/Akavache.Mobile/Akavache.Mobile.csproj | 2 +- src/Akavache.Mobile/AkavacheDriver.cs | 2 +- src/Akavache.Sqlite3/Akavache.Sqlite3.csproj | 4 +- src/Akavache.Sqlite3/AsyncLock.cs | 2 +- src/Akavache.Sqlite3/Queues/OperationQueue.cs | 6 +- .../Queues/OperationQueueCoalescing.cs | 30 +- src/Akavache.Sqlite3/Registrations.cs | 12 +- src/Akavache.Sqlite3/SQLite.cs | 74 ++--- .../SqlLiteCache/SqlRawPersistentBlobCache.cs | 31 +- ...ovalTests.AkavacheCore.net461.approved.txt | 13 +- ...ovalTests.AkavacheCore.net5.0.approved.txt | 269 ++++++++++++++++++ ...ts.AkavacheCore.netcoreapp3.1.approved.txt | 13 +- ...lTests.AkavacheDrawing.net461.approved.txt | 1 + ...lTests.AkavacheDrawing.net5.0.approved.txt | 24 ++ ...AkavacheDrawing.netcoreapp3.1.approved.txt | 1 + ...lTests.AkavacheProject.net461.approved.txt | 1 + ...lTests.AkavacheProject.net5.0.approved.txt | 19 ++ ...AkavacheProject.netcoreapp3.1.approved.txt | 1 + src/Akavache.Tests/API/ApiApprovalTests.cs | 3 +- src/Akavache.Tests/Akavache.Tests.csproj | 2 +- .../FakeDateTimeHighPrecisionJsonConverter.cs | 2 +- .../SqliteBlobCacheExtensionsTests.cs | 2 +- .../TestBases/BlobCacheExtensionsTestBase.cs | 2 +- src/Akavache/Akavache.Sqlite3.BundleE.csproj | 2 +- src/Akavache/Akavache.csproj | 2 +- src/Directory.build.props | 2 +- version.json | 2 +- 42 files changed, 540 insertions(+), 157 deletions(-) create mode 100644 src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net5.0.approved.txt create mode 100644 src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net5.0.approved.txt create mode 100644 src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net5.0.approved.txt diff --git a/src/Akavache.Core/Akavache.Core.csproj b/src/Akavache.Core/Akavache.Core.csproj index 92d63bfcc..5b5452321 100644 --- a/src/Akavache.Core/Akavache.Core.csproj +++ b/src/Akavache.Core/Akavache.Core.csproj @@ -1,7 +1,7 @@  - netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;tizen40 - $(TargetFrameworks);net461;uap10.0.16299 + netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid10.0;tizen40;net5.0 + $(TargetFrameworks);net461;uap10.0.16299;net5.0-windows Akavache.Core Akavache An asynchronous, persistent key-value store for desktop and mobile applications on .NET diff --git a/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs b/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs index 9ae5e70ff..f8ba225e0 100644 --- a/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs +++ b/src/Akavache.Core/BlobCache/InMemoryBlobCache.cs @@ -97,7 +97,7 @@ public DateTimeKind? ForcedDateTimeKind { _dateTimeKind = value; - if (_jsonDateTimeContractResolver != null) + if (_jsonDateTimeContractResolver is not null) { _jsonDateTimeContractResolver.ForceDateTimeKindOverride = value; } @@ -198,7 +198,7 @@ public IObservable Get(string key) return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); } - CacheEntry entry; + CacheEntry? entry; lock (_cache) { if (!_cache.TryGetValue(key, out entry)) @@ -207,7 +207,12 @@ public IObservable Get(string key) } } - if (entry.ExpiresAt != null && Scheduler.Now > entry.ExpiresAt.Value) + if (entry is null) + { + return ExceptionHelper.ObservableThrowKeyNotFoundException(key); + } + + if (entry.ExpiresAt is not null && Scheduler.Now > entry.ExpiresAt.Value) { lock (_cache) { @@ -228,7 +233,7 @@ public IObservable Get(string key) return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); } - CacheEntry entry; + CacheEntry? entry; lock (_cache) { if (!_cache.TryGetValue(key, out entry)) @@ -237,6 +242,11 @@ public IObservable Get(string key) } } + if (entry is null) + { + return ExceptionHelper.ObservableThrowKeyNotFoundException(key); + } + return Observable.Return(entry.CreatedAt, Scheduler); } @@ -251,7 +261,7 @@ public IObservable> GetAllKeys() lock (_cache) { return Observable.Return(_cache - .Where(x => x.Value.ExpiresAt == null || x.Value.ExpiresAt >= Scheduler.Now) + .Where(x => x.Value.ExpiresAt is null || x.Value.ExpiresAt >= Scheduler.Now) .Select(x => x.Key) .ToList()); } @@ -315,7 +325,7 @@ public IObservable GetObject(string key) return ExceptionHelper.ObservableThrowObjectDisposedException("InMemoryBlobCache"); } - CacheEntry entry; + CacheEntry? entry; lock (_cache) { if (!_cache.TryGetValue(key, out entry)) @@ -324,7 +334,12 @@ public IObservable GetObject(string key) } } - if (entry.ExpiresAt != null && Scheduler.Now > entry.ExpiresAt.Value) + if (entry is null) + { + return ExceptionHelper.ObservableThrowKeyNotFoundException(key); + } + + if (entry.ExpiresAt is not null && Scheduler.Now > entry.ExpiresAt.Value) { lock (_cache) { @@ -357,9 +372,10 @@ public IObservable> GetAllObjects() { return Observable.Return( _cache - .Where(x => x.Value.TypeName == typeof(T).FullName && (x.Value.ExpiresAt == null || x.Value.ExpiresAt >= Scheduler.Now)) + .Where(x => x.Value.TypeName == typeof(T).FullName && (x.Value.ExpiresAt is null || x.Value.ExpiresAt >= Scheduler.Now)) .Select(x => DeserializeObject(x.Value.Value)) - .ToList(), Scheduler); + .ToList(), + Scheduler); } } @@ -404,7 +420,7 @@ public IObservable Vacuum() lock (_cache) { - var toDelete = _cache.Where(x => x.Value.ExpiresAt != null && Scheduler.Now > x.Value.ExpiresAt).ToArray(); + var toDelete = _cache.Where(x => x.Value.ExpiresAt is not null && Scheduler.Now > x.Value.ExpiresAt).ToArray(); foreach (var kvp in toDelete) { _cache.Remove(kvp.Key); diff --git a/src/Akavache.Core/BulkOperationsMixin.cs b/src/Akavache.Core/BulkOperationsMixin.cs index a365c22f9..9f6a7bb86 100644 --- a/src/Akavache.Core/BulkOperationsMixin.cs +++ b/src/Akavache.Core/BulkOperationsMixin.cs @@ -129,12 +129,10 @@ public static IObservable> GetObjects(this IBlobCache } return keys.ToObservable() - .SelectMany(x => - { - return blobCache.GetObject(x) - .Select(y => new KeyValuePair(x, y)) - .Catch, KeyNotFoundException>(_ => Observable.Empty>()); - }) + .SelectMany(x => blobCache.GetObject(x) + .Where(y => y is not null) + .Select(y => new KeyValuePair(x, y!)) + .Catch, KeyNotFoundException>(_ => Observable.Empty>())) .ToDictionary(k => k.Key, v => v.Value); } diff --git a/src/Akavache.Core/DependencyResolverMixin.cs b/src/Akavache.Core/DependencyResolverMixin.cs index 39be85aaf..29030872f 100644 --- a/src/Akavache.Core/DependencyResolverMixin.cs +++ b/src/Akavache.Core/DependencyResolverMixin.cs @@ -37,7 +37,7 @@ public static void InitializeAkavache(this IMutableDependencyResolver resolver, var fdr = typeof(DependencyResolverMixin); - if (fdr == null || fdr.AssemblyQualifiedName is null) + if (fdr is null || fdr.AssemblyQualifiedName is null) { throw new Exception($"Cannot find valid assembly name for the {nameof(DependencyResolverMixin)} class."); } @@ -45,6 +45,11 @@ public static void InitializeAkavache(this IMutableDependencyResolver resolver, var assemblyName = new AssemblyName( fdr.AssemblyQualifiedName.Replace(fdr.FullName + ", ", string.Empty)); + if (assemblyName.Name is null) + { + throw new InvalidOperationException("Could not find a valid name for assembly"); + } + foreach (var ns in namespaces) { var targetType = ns + ".Registrations"; @@ -56,7 +61,13 @@ public static void InitializeAkavache(this IMutableDependencyResolver resolver, continue; } - var registerer = (IWantsToRegisterStuff)Activator.CreateInstance(registerTypeClass); + var registerer = (IWantsToRegisterStuff?)Activator.CreateInstance(registerTypeClass); + + if (registerer is null) + { + continue; + } + registerer.Register(resolver, readonlyDependencyResolver); } } diff --git a/src/Akavache.Core/Json/JsonDateTimeContractResolver.cs b/src/Akavache.Core/Json/JsonDateTimeContractResolver.cs index 0dbf3a3cc..34e631196 100644 --- a/src/Akavache.Core/Json/JsonDateTimeContractResolver.cs +++ b/src/Akavache.Core/Json/JsonDateTimeContractResolver.cs @@ -41,7 +41,7 @@ public JsonDateTimeContractResolver(IContractResolver? contractResolver, DateTim public override JsonContract ResolveContract(Type type) { var contract = ExistingContractResolver?.ResolveContract(type); - if (contract?.Converter != null) + if (contract?.Converter is not null) { return contract; } diff --git a/src/Akavache.Core/Json/JsonDateTimeOffsetTickConverter.cs b/src/Akavache.Core/Json/JsonDateTimeOffsetTickConverter.cs index 18b2262b4..74e683d43 100644 --- a/src/Akavache.Core/Json/JsonDateTimeOffsetTickConverter.cs +++ b/src/Akavache.Core/Json/JsonDateTimeOffsetTickConverter.cs @@ -22,7 +22,7 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { - if (reader.TokenType == JsonToken.Date && reader.Value != null) + if (reader.TokenType == JsonToken.Date && reader.Value is not null) { return (DateTimeOffset)reader.Value; } diff --git a/src/Akavache.Core/Json/JsonDateTimeTickConverter.cs b/src/Akavache.Core/Json/JsonDateTimeTickConverter.cs index 343402fb2..1cf9394c0 100644 --- a/src/Akavache.Core/Json/JsonDateTimeTickConverter.cs +++ b/src/Akavache.Core/Json/JsonDateTimeTickConverter.cs @@ -48,12 +48,12 @@ public override bool CanConvert(Type objectType) return null; } - if (reader.TokenType == JsonToken.Date && reader.Value != null) + if (reader.TokenType == JsonToken.Date && reader.Value is not null) { return (DateTime)reader.Value; } - if ((objectType == typeof(DateTime) || objectType == typeof(DateTime?)) && reader.Value != null) + if ((objectType == typeof(DateTime) || objectType == typeof(DateTime?)) && reader.Value is not null) { var ticks = (long)reader.Value; diff --git a/src/Akavache.Core/Json/JsonSerializationMixin.cs b/src/Akavache.Core/Json/JsonSerializationMixin.cs index b74340552..8485f9c49 100644 --- a/src/Akavache.Core/Json/JsonSerializationMixin.cs +++ b/src/Akavache.Core/Json/JsonSerializationMixin.cs @@ -80,7 +80,7 @@ public static IObservable InsertAllObjects(this IBlobCache blobCache, I /// The key to look up in the cache /// modified key name. If this is true, GetAllObjects will not find this object. /// A Future result representing the object in the cache. - public static IObservable GetObject(this IBlobCache blobCache, string key) + public static IObservable GetObject(this IBlobCache blobCache, string key) { if (blobCache is null) { @@ -122,7 +122,7 @@ public static IObservable> GetAllObjects(this IBlobCache blobC .Where(y => y.StartsWith(GetTypePrefixedKey(string.Empty, typeof(T)), StringComparison.InvariantCulture)) .ToObservable()) - .SelectMany(x => blobCache.GetObject(x) + .SelectMany(x => blobCache.GetObject(x).Where(x => x is not null).Select(x => x!) .Catch(Observable.Empty())) .ToList(); } @@ -147,14 +147,14 @@ public static IObservable> GetAllObjects(this IBlobCache blobC /// The type of item to get. /// A Future result representing the deserialized object from /// the cache. - public static IObservable GetOrFetchObject(this IBlobCache blobCache, string key, Func> fetchFunc, DateTimeOffset? absoluteExpiration = null) + public static IObservable GetOrFetchObject(this IBlobCache blobCache, string key, Func> fetchFunc, DateTimeOffset? absoluteExpiration = null) { if (blobCache is null) { throw new ArgumentNullException(nameof(blobCache)); } - return blobCache.GetObject(key).Catch(ex => + return blobCache.GetObject(key).Catch(ex => { var prefixedKey = blobCache.GetHashCode().ToString(CultureInfo.InvariantCulture) + key; @@ -184,7 +184,7 @@ public static IObservable GetOrFetchObject(this IBlobCache blobCache, stri /// An optional expiration date. /// A Future result representing the deserialized object from /// the cache. - public static IObservable GetOrFetchObject(this IBlobCache blobCache, string key, Func> fetchFunc, DateTimeOffset? absoluteExpiration = null) + public static IObservable GetOrFetchObject(this IBlobCache blobCache, string key, Func> fetchFunc, DateTimeOffset? absoluteExpiration = null) { if (blobCache is null) { @@ -210,7 +210,7 @@ public static IObservable GetOrFetchObject(this IBlobCache blobCache, stri /// An optional expiration date. /// A Future result representing the deserialized object from /// the cache. - public static IObservable GetOrCreateObject(this IBlobCache blobCache, string key, Func fetchFunc, DateTimeOffset? absoluteExpiration = null) + public static IObservable GetOrCreateObject(this IBlobCache blobCache, string key, Func fetchFunc, DateTimeOffset? absoluteExpiration = null) { if (blobCache is null) { @@ -275,7 +275,7 @@ public static IObservable GetOrCreateObject(this IBlobCache blobCache, str /// An Observable stream containing either one or two /// results (possibly a cached version, then the latest version). [SuppressMessage("Design", "CA2000: call dispose", Justification = "Disposed by member")] - public static IObservable GetAndFetchLatest( + public static IObservable GetAndFetchLatest( this IBlobCache blobCache, string key, Func> fetchFunc, @@ -291,7 +291,7 @@ public static IObservable GetAndFetchLatest( #pragma warning disable CS8604 // Possible null reference argument. var fetch = Observable.Defer(() => blobCache.GetObjectCreatedAt(key)) - .Select(x => fetchPredicate == null || x == null || fetchPredicate(x.Value)) + .Select(x => fetchPredicate is null || x is null || fetchPredicate(x.Value)) .Where(x => x) .SelectMany(_ => { @@ -305,23 +305,28 @@ public static IObservable GetAndFetchLatest( return fetchObs .SelectMany(x => - cacheValidationPredicate != null && !cacheValidationPredicate(x) + cacheValidationPredicate is not null && !cacheValidationPredicate(x) ? Observable.Return(default(T)) : blobCache.InvalidateObject(key).Select(__ => x)) .SelectMany(x => - cacheValidationPredicate != null && !cacheValidationPredicate(x) + cacheValidationPredicate is not null && !cacheValidationPredicate(x) ? Observable.Return(default(T)) : blobCache.InsertObject(key, x, absoluteExpiration).Select(__ => x)); }); - var result = blobCache.GetObject(key).Select(x => new Tuple(x, true)) - .Catch(Observable.Return(new Tuple(default(T), false))); + if (fetch is null) + { + return Observable.Throw(new Exception("Could not find a valid way to fetch the value")); + } + + var result = blobCache.GetObject(key).Select(x => (x, true)) + .Catch(Observable.Return((default(T), false))); #pragma warning restore CS8604 // Possible null reference argument. return result.SelectMany(x => x.Item2 ? Observable.Return(x.Item1) : Observable.Empty()) .Concat(fetch) - .Multicast(new ReplaySubject()) + .Multicast(new ReplaySubject()) .RefCount(); } @@ -356,7 +361,7 @@ public static IObservable GetAndFetchLatest( /// if the fetched value should be cached. /// An Observable stream containing either one or two /// results (possibly a cached version, then the latest version). - public static IObservable GetAndFetchLatest( + public static IObservable GetAndFetchLatest( this IBlobCache blobCache, string key, Func> fetchFunc, @@ -447,7 +452,7 @@ internal static byte[] SerializeObject(T value) return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value, settings)); } - internal static IObservable DeserializeObject(byte[] x) + internal static IObservable DeserializeObject(byte[] x) { var settings = Locator.Current.GetService(); diff --git a/src/Akavache.Core/KeyedOperations/KeyedOperationQueue.cs b/src/Akavache.Core/KeyedOperations/KeyedOperationQueue.cs index 2ae4b97c8..342924398 100644 --- a/src/Akavache.Core/KeyedOperations/KeyedOperationQueue.cs +++ b/src/Akavache.Core/KeyedOperations/KeyedOperationQueue.cs @@ -102,7 +102,7 @@ public IObservable ShutdownQueue() { lock (_queuedOps) { - if (_shutdownObs != null) + if (_shutdownObs is not null) { return _shutdownObs; } @@ -113,7 +113,7 @@ public IObservable ShutdownQueue() var sub = _resultObs.Materialize() .Where(x => x.Kind != NotificationKind.OnNext) .SelectMany(x => - (x.Kind == NotificationKind.OnError) ? + (x.Kind == NotificationKind.OnError && x.Exception is not null) ? Observable.Throw(x.Exception) : Observable.Return(Unit.Default)) .Multicast(_shutdownObs); @@ -156,19 +156,20 @@ private IObservable SafeStart(Func calculationFunc) var ret = new AsyncSubject(); Observable.Start( () => - { - try - { - var val = calculationFunc(); - ret.OnNext(val); - ret.OnCompleted(); - } - catch (Exception ex) { - this.Log().Warn(ex, "Failure running queued op"); - ret.OnError(ex); - } - }, _scheduler); + try + { + var val = calculationFunc(); + ret.OnNext(val); + ret.OnCompleted(); + } + catch (Exception ex) + { + this.Log().Warn(ex, "Failure running queued op"); + ret.OnError(ex); + } + }, + _scheduler); return ret; } diff --git a/src/Akavache.Core/Platforms/shared/AkavacheHttpMixin.cs b/src/Akavache.Core/Platforms/shared/AkavacheHttpMixin.cs index 93109afda..6d255d947 100644 --- a/src/Akavache.Core/Platforms/shared/AkavacheHttpMixin.cs +++ b/src/Akavache.Core/Platforms/shared/AkavacheHttpMixin.cs @@ -174,7 +174,8 @@ private static IObservable MakeWebRequest( { hwr.GetRequestStream().Write(buf, 0, buf.Length); return hwr.GetResponse(); - }, BlobCache.TaskpoolScheduler); + }, + BlobCache.TaskpoolScheduler); }); } else @@ -201,7 +202,8 @@ private static IObservable MakeWebRequest( .SelectMany(x => x.WriteAsyncRx(buf, 0, buf.Length)) .SelectMany(_ => Observable.FromAsync(() => Task.Factory.FromAsync(hwr.BeginGetResponse, hwr.EndGetResponse, hwr))) .Multicast(ret).Connect(); - }, BlobCache.TaskpoolScheduler); + }, + BlobCache.TaskpoolScheduler); return ret; }); @@ -213,7 +215,7 @@ private static IObservable MakeWebRequest( private static WebRequest CreateWebRequest(Uri uri, IDictionary? headers) { var hwr = WebRequest.Create(uri); - if (headers != null) + if (headers is not null) { foreach (var x in headers) { diff --git a/src/Akavache.Core/Platforms/shared/Registrations.cs b/src/Akavache.Core/Platforms/shared/Registrations.cs index c8de69590..1b122456c 100644 --- a/src/Akavache.Core/Platforms/shared/Registrations.cs +++ b/src/Akavache.Core/Platforms/shared/Registrations.cs @@ -64,7 +64,8 @@ public void Register(IMutableDependencyResolver resolver, IReadonlyDependencyRes #if ANDROID var packageManager = Application.Context.PackageManager; - var applicationLabel = packageManager?.GetApplicationInfo(Application.Context.PackageName, 0)?.LoadLabel(packageManager); + var packageName = Application.Context.PackageName ?? "Unknown Package"; + var applicationLabel = packageManager?.GetApplicationInfo(packageName, 0)?.LoadLabel(packageManager); BlobCache.ApplicationName = applicationLabel ?? "Unknown"; diff --git a/src/Akavache.Core/Platforms/shared/Utility.cs b/src/Akavache.Core/Platforms/shared/Utility.cs index e34232de4..ec29e71ad 100644 --- a/src/Akavache.Core/Platforms/shared/Utility.cs +++ b/src/Akavache.Core/Platforms/shared/Utility.cs @@ -84,7 +84,8 @@ public static IObservable SafeOpenFileAsync(string path, FileMode mode, { ret.OnError(ex); } - }, scheduler); + }, + scheduler); return ret; } @@ -108,7 +109,7 @@ public static IEnumerable SplitFullPath(this DirectoryInfo directoryInfo { var root = Path.GetPathRoot(directoryInfo.FullName); var components = new List(); - for (var path = directoryInfo.FullName; path != root && path != null; path = Path.GetDirectoryName(path)) + for (var path = directoryInfo.FullName; path != root && path is not null; path = Path.GetDirectoryName(path)) { var filename = Path.GetFileName(path); if (string.IsNullOrEmpty(filename)) @@ -119,7 +120,11 @@ public static IEnumerable SplitFullPath(this DirectoryInfo directoryInfo components.Add(filename); } - components.Add(root); + if (root is not null) + { + components.Add(root); + } + components.Reverse(); return components; } @@ -143,7 +148,8 @@ public static IObservable LogErrors(this IObservable observable, string var msg = message ?? "0x" + observable.GetHashCode().ToString("x", CultureInfo.InvariantCulture); LogHost.Default.Info(ex, "{0} failed", msg); subj.OnError(ex); - }, subj.OnCompleted); + }, + subj.OnCompleted); }); } @@ -198,7 +204,8 @@ public static IObservable CopyToAsync(this Stream stream, Stream destinati stream.Dispose(); destination.Dispose(); } - }, scheduler ?? BlobCache.TaskpoolScheduler); + }, + scheduler ?? BlobCache.TaskpoolScheduler); #endif } } diff --git a/src/Akavache.CosmosDB/Akavache.CosmosDB.csproj b/src/Akavache.CosmosDB/Akavache.CosmosDB.csproj index c5b3606c0..ca12aa9b5 100644 --- a/src/Akavache.CosmosDB/Akavache.CosmosDB.csproj +++ b/src/Akavache.CosmosDB/Akavache.CosmosDB.csproj @@ -1,7 +1,7 @@ - netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;tizen40 + netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid10.0;tizen40 $(TargetFrameworks);net461;uap10.0.16299 Akavache.CosmosDB Akavache.CosmosDB diff --git a/src/Akavache.Drawing/Akavache.Drawing.csproj b/src/Akavache.Drawing/Akavache.Drawing.csproj index 4d09722e6..b84008574 100644 --- a/src/Akavache.Drawing/Akavache.Drawing.csproj +++ b/src/Akavache.Drawing/Akavache.Drawing.csproj @@ -1,7 +1,7 @@ - netstandard2.0;MonoAndroid90;Xamarin.iOS10;Xamarin.Mac20;Xamarin.TVOS10;Xamarin.WatchOS10;tizen40 - $(TargetFrameworks);net461;uap10.0.16299;netcoreapp3.1 + netstandard2.0;MonoAndroid10.0;Xamarin.iOS10;Xamarin.Mac20;Xamarin.TVOS10;Xamarin.WatchOS10;tizen40 + $(TargetFrameworks);net461;uap10.0.16299;netcoreapp3.1;net5.0-windows Akavache.Drawing Akavache An asynchronous, persistent key-value store for desktop and mobile applications on .NET diff --git a/src/Akavache.Drawing/BitmapImageMixin.cs b/src/Akavache.Drawing/BitmapImageMixin.cs index c82cd39c7..4a39484b6 100644 --- a/src/Akavache.Drawing/BitmapImageMixin.cs +++ b/src/Akavache.Drawing/BitmapImageMixin.cs @@ -147,7 +147,7 @@ public static IObservable LoadImageFromUrl(this IBlobCache blobCache, s /// too small). public static IObservable ThrowOnBadImageBuffer(byte[] compressedImage) { - return (compressedImage == null || compressedImage.Length < 64) ? + return (compressedImage is null || compressedImage.Length < 64) ? Observable.Throw(new Exception("Invalid Image")) : Observable.Return(compressedImage); } diff --git a/src/Akavache.Mobile/Akavache.Mobile.csproj b/src/Akavache.Mobile/Akavache.Mobile.csproj index eb4bb2d5a..8a582bbde 100644 --- a/src/Akavache.Mobile/Akavache.Mobile.csproj +++ b/src/Akavache.Mobile/Akavache.Mobile.csproj @@ -1,7 +1,7 @@  - netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;tizen40 + netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid10.0;tizen40;net5.0 $(TargetFrameworks);net461;uap10.0.16299 Akavache.Mobile Akavache.Mobile diff --git a/src/Akavache.Mobile/AkavacheDriver.cs b/src/Akavache.Mobile/AkavacheDriver.cs index f45647763..893be93a9 100644 --- a/src/Akavache.Mobile/AkavacheDriver.cs +++ b/src/Akavache.Mobile/AkavacheDriver.cs @@ -19,7 +19,7 @@ public class AkavacheDriver : ISuspensionDriver, IEnableLogger /// public IObservable LoadState() { - return BlobCache.UserAccount.GetObject("__AppState"); + return BlobCache.UserAccount.GetObject("__AppState")!; } /// diff --git a/src/Akavache.Sqlite3/Akavache.Sqlite3.csproj b/src/Akavache.Sqlite3/Akavache.Sqlite3.csproj index 657bfdb2b..1a57d5239 100644 --- a/src/Akavache.Sqlite3/Akavache.Sqlite3.csproj +++ b/src/Akavache.Sqlite3/Akavache.Sqlite3.csproj @@ -1,8 +1,8 @@  - netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;tizen40 - $(TargetFrameworks);net461;uap10.0.16299 + netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid10.0;tizen40 + $(TargetFrameworks);net461;uap10.0.16299;net5.0 Akavache.Sqlite3 Akavache.Sqlite3 Akavache Sqlite3 diff --git a/src/Akavache.Sqlite3/AsyncLock.cs b/src/Akavache.Sqlite3/AsyncLock.cs index 7a74f88ed..729b5e86f 100644 --- a/src/Akavache.Sqlite3/AsyncLock.cs +++ b/src/Akavache.Sqlite3/AsyncLock.cs @@ -46,7 +46,7 @@ public AsyncLock() return wait .ContinueWith( - (task, state) => task.IsCanceled ? null : (IDisposable)state, + (task, state) => task.IsCanceled || state is null ? null : (IDisposable)state, _releaser.Result, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, diff --git a/src/Akavache.Sqlite3/Queues/OperationQueue.cs b/src/Akavache.Sqlite3/Queues/OperationQueue.cs index c78476ce4..2c1903147 100644 --- a/src/Akavache.Sqlite3/Queues/OperationQueue.cs +++ b/src/Akavache.Sqlite3/Queues/OperationQueue.cs @@ -90,7 +90,7 @@ internal SqliteOperationQueue() /// A disposable which when Disposed will stop the queue. public IDisposable Start() { - if (_start != null) + if (_start is not null) { return _start; } @@ -127,7 +127,7 @@ public IDisposable Start() // in the empty list case, we want to wait until we have an item. // Once we have a single item, we try to fetch as many as possible // until we've got enough items. - OperationQueueItem item; + OperationQueueItem? item; try { item = _operationQueue.Take(_shouldQuit.Token); @@ -146,7 +146,7 @@ public IDisposable Start() } toProcess.Add(item); - while (toProcess.Count < Constants.OperationQueueChunkSize && _operationQueue.TryTake(out item)) + while (toProcess.Count < Constants.OperationQueueChunkSize && _operationQueue.TryTake(out item) && item is not null) { toProcess.Add(item); } diff --git a/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs b/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs index 8fcddc240..0ac2ffe96 100644 --- a/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs +++ b/src/Akavache.Sqlite3/Queues/OperationQueueCoalescing.cs @@ -61,7 +61,7 @@ internal static List CoalesceOperations(List MultipleOpsTurnIntoSingleOp(IEnum continue; } - if (currentWrites != null) + if (currentWrites is not null) { if (currentWrites.Count == 1) { @@ -163,7 +163,7 @@ private static IEnumerable MultipleOpsTurnIntoSingleOp(IEnum yield return item; } - if (currentWrites != null) + if (currentWrites is not null) { yield return new OperationQueueItem( CombineSubjectsByOperation( @@ -187,7 +187,13 @@ private static OperationQueueItem GroupUnrelatedSelects(IEnumerable { subj.Subscribe(x.CompletionAsUnit); - return x.ParametersAsElements; + return x.ParametersAsElements ?? Enumerable.Empty(); }).ToList(); return OperationQueueItem.CreateInsert( @@ -269,7 +275,7 @@ private static OperationQueueItem GroupUnrelatedDeletes(IEnumerable { subj.Subscribe(x.CompletionAsUnit); - return x.ParametersAsKeys; + return x.ParametersAsKeys ?? Enumerable.Empty(); }).ToList(); return OperationQueueItem.CreateInvalidate( @@ -282,19 +288,19 @@ private static OperationQueueItem GroupUnrelatedDeletes(IEnumerable localCache.Value, typeof(IBlobCache), "LocalMachine"); @@ -62,13 +62,13 @@ public void Register(IMutableDependencyResolver resolver, IReadonlyDependencyRes { var directory = fs.GetDefaultRoamingCacheDirectory(); - if (directory == null || string.IsNullOrWhiteSpace(directory)) + if (directory is null || string.IsNullOrWhiteSpace(directory)) { throw new InvalidOperationException("There is a invalid directory being returned by the file system provider."); } fs.CreateRecursive(directory).SubscribeOn(BlobCache.TaskpoolScheduler).Wait(); - return new SqlRawPersistentBlobCache(Path.Combine(fs.GetDefaultRoamingCacheDirectory(), "userblobs.db"), BlobCache.TaskpoolScheduler); + return new SqlRawPersistentBlobCache(Path.Combine(directory, "userblobs.db"), BlobCache.TaskpoolScheduler); }); resolver.Register(() => userAccount.Value, typeof(IBlobCache), "UserAccount"); @@ -76,13 +76,13 @@ public void Register(IMutableDependencyResolver resolver, IReadonlyDependencyRes { var directory = fs.GetDefaultSecretCacheDirectory(); - if (directory == null || string.IsNullOrWhiteSpace(directory)) + if (directory is null || string.IsNullOrWhiteSpace(directory)) { throw new InvalidOperationException("There is a invalid directory being returned by the file system provider."); } fs.CreateRecursive(directory).SubscribeOn(BlobCache.TaskpoolScheduler).Wait(); - return new SQLiteEncryptedBlobCache(Path.Combine(fs.GetDefaultSecretCacheDirectory(), "secret.db"), Locator.Current.GetService(), BlobCache.TaskpoolScheduler); + return new SQLiteEncryptedBlobCache(Path.Combine(directory, "secret.db"), Locator.Current.GetService(), BlobCache.TaskpoolScheduler); }); resolver.Register(() => secure.Value, typeof(ISecureBlobCache)); } diff --git a/src/Akavache.Sqlite3/SQLite.cs b/src/Akavache.Sqlite3/SQLite.cs index 1fb0e7724..ed3057a59 100644 --- a/src/Akavache.Sqlite3/SQLite.cs +++ b/src/Akavache.Sqlite3/SQLite.cs @@ -87,10 +87,10 @@ protected NotNullConstraintViolationException(SQLite3.Result r, string message) protected NotNullConstraintViolationException(SQLite3.Result r, string message, TableMapping mapping, object obj) : base(r, message) { - if (mapping != null && obj != null) + if (mapping is not null && obj is not null) { this.Columns = from c in mapping.Columns - where c.IsNullable == false && c.GetValue(obj) == null + where c.IsNullable == false && c.GetValue(obj) is null select c; } } @@ -273,7 +273,7 @@ public TimeSpan BusyTimeout set { _busyTimeout = value; - if (Handle != NullHandle) + if (Handle == NullHandle) { SQLite3.BusyTimeout(Handle, (int)_busyTimeout.TotalMilliseconds); } @@ -288,7 +288,7 @@ public IEnumerable TableMappings { get { - return _tables != null ? _tables.Values : Enumerable.Empty(); + return _tables is not null ? _tables.Values : Enumerable.Empty(); } } @@ -1320,7 +1320,7 @@ public int Insert(object obj, string extra) /// public int Insert(object obj, string extra, Type objType) { - if (obj == null || objType is null) + if (obj is null || objType is null) { return 0; } @@ -1329,15 +1329,15 @@ public int Insert(object obj, string extra, Type objType) var map = GetMapping(objType); #if USE_NEW_REFLECTION_API - if (map.PK != null && map.PK.IsAutoGuid) + if (map.PK is not null && map.PK.IsAutoGuid) { // no GetProperty so search our way up the inheritance chain till we find it PropertyInfo prop; - while (objType != null) + while (objType is not null) { var info = objType.GetTypeInfo(); prop = info.GetDeclaredProperty(map.PK.PropertyName); - if (prop != null) + if (prop is not null) { if (prop.GetValue(obj, null).Equals(Guid.Empty)) { @@ -1350,9 +1350,9 @@ public int Insert(object obj, string extra, Type objType) } } #else - if (map.PK != null && map.PK.IsAutoGuid) { + if (map.PK is not null && map.PK.IsAutoGuid) { var prop = objType.GetProperty(map.PK.PropertyName); - if (prop != null) { + if (prop is not null) { if (prop.GetValue(obj, null).Equals(Guid.Empty)) { prop.SetValue(obj, Guid.NewGuid(), null); } @@ -1436,7 +1436,7 @@ public int Update(object obj) public int Update(object obj, Type objType) { int rowsAffected = 0; - if (obj == null || objType is null) + if (obj is null || objType is null) { return 0; } @@ -1588,11 +1588,11 @@ protected virtual void Dispose(bool disposing) public void Close() { - if (_open && Handle != NullHandle) + if (_open && Handle == NullHandle) { try { - if (_mappings != null) + if (_mappings is not null) { foreach (var sqlInsertCommand in _mappings.Values) { @@ -1617,7 +1617,7 @@ public void Close() void OnTableChanged(TableMapping table, NotifyTableChangedAction action) { var ev = TableChanged; - if (ev != null) + if (ev is not null) ev(this, new NotifyTableChangedEventArgs(table, action)); } @@ -1779,13 +1779,13 @@ public TableMapping(Type type, CreateFlags createFlags = CreateFlags.None) var tableAttr = (TableAttribute)type.GetCustomAttributes (typeof (TableAttribute), true).FirstOrDefault (); #endif - TableName = tableAttr != null ? tableAttr.Name : MappedType.Name; + TableName = tableAttr is not null ? tableAttr.Name : MappedType.Name; #if !USE_NEW_REFLECTION_API var props = MappedType.GetProperties (BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty); #else var props = from p in MappedType.GetRuntimeProperties() - where ((p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic) || (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic)) + where ((p.GetMethod is not null && p.GetMethod.IsPublic) || (p.SetMethod is not null && p.SetMethod.IsPublic) || (p.GetMethod is not null && p.GetMethod.IsStatic) || (p.SetMethod is not null && p.SetMethod.IsStatic)) select p; #endif var cols = new List(); @@ -1814,9 +1814,9 @@ public TableMapping(Type type, CreateFlags createFlags = CreateFlags.None) } } - HasAutoIncPK = _autoPk != null; + HasAutoIncPK = _autoPk is not null; - if (PK != null) + if (PK is not null) { GetByPrimaryKeySql = string.Format("select * from \"{0}\" where \"{1}\" = ?", TableName, PK.Name); } @@ -1831,7 +1831,7 @@ public TableMapping(Type type, CreateFlags createFlags = CreateFlags.None) public void SetAutoIncPK(object obj, long id) { - if (_autoPk != null) + if (_autoPk is not null) { _autoPk.SetValue(obj, Convert.ChangeType(id, _autoPk.ColumnType, null)); } @@ -1924,7 +1924,7 @@ PreparedSqlLiteInsertCommand CreateInsertCommand(SQLiteConnection conn, string e protected internal void Dispose() { - if (_insertCommand != null) + if (_insertCommand is not null) { _insertCommand.Dispose(); _insertCommand = null; @@ -1959,7 +1959,7 @@ public Column(PropertyInfo prop, CreateFlags createFlags = CreateFlags.None) var colAttr = (ColumnAttribute)prop.GetCustomAttributes(typeof(ColumnAttribute), true).FirstOrDefault(); _prop = prop; - Name = colAttr == null ? prop.Name : colAttr.Name; + Name = colAttr is null ? prop.Name : colAttr.Name; //If this type is Nullable then Nullable.GetUnderlyingType returns the T, otherwise it returns null, so get the actual type instead ColumnType = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType; Collation = Orm.Collation(prop); @@ -2350,7 +2350,7 @@ void BindAll(Sqlite3Statement stmt) int nextIdx = 1; foreach (var b in _bindings) { - if (b.Name != null) + if (b.Name is not null) { b.Index = SQLite3.BindParameterIndex(stmt, b.Name); } @@ -2584,7 +2584,7 @@ public int ExecuteNonQuery(object[] source) } //bind the values. - if (source != null) + if (source is not null) { for (int i = 0; i < source.Length; i++) { @@ -2631,7 +2631,7 @@ public void Dispose() private void Dispose(bool disposing) { - if (Statement != NullStatement) + if (Statement == NullStatement) { try { @@ -2696,7 +2696,7 @@ public TableQuery Clone() var q = new TableQuery(Connection, Table); q._where = _where; q._deferred = _deferred; - if (_orderBys != null) + if (_orderBys is not null) { q._orderBys = new List(_orderBys); } @@ -2783,7 +2783,7 @@ private TableQuery AddOrderBy(Expression> orderExpr, bool asc) MemberExpression mem = null; var unary = lambda.Body as UnaryExpression; - if (unary != null && unary.NodeType == ExpressionType.Convert) + if (unary is not null && unary.NodeType == ExpressionType.Convert) { mem = unary.Operand as MemberExpression; } @@ -2792,7 +2792,7 @@ private TableQuery AddOrderBy(Expression> orderExpr, bool asc) mem = lambda.Body as MemberExpression; } - if (mem != null && (mem.Expression.NodeType == ExpressionType.Parameter)) + if (mem is not null && (mem.Expression.NodeType == ExpressionType.Parameter)) { var q = Clone(); if (q._orderBys is null) @@ -2855,7 +2855,7 @@ public TableQuery Select(Expression> selector private SQLiteCommand GenerateCommand(string selectionList) { - if (_joinInner != null && _joinOuter != null) + if (_joinInner is not null && _joinOuter is not null) { throw new NotSupportedException("Joins are not supported."); } @@ -2863,12 +2863,12 @@ private SQLiteCommand GenerateCommand(string selectionList) { var cmdText = "select " + selectionList + " from \"" + Table.TableName + "\""; var args = new List(); - if (_where != null) + if (_where is not null) { var w = CompileExpr(_where, args); cmdText += " where " + w.CommandText; } - if ((_orderBys != null) && (_orderBys.Count > 0)) + if ((_orderBys is not null) && (_orderBys.Count > 0)) { var t = string.Join(", ", _orderBys.Select(o => "\"" + o.ColumnName + "\"" + (o.Ascending ? "" : " desc")).ToArray()); cmdText += " order by " + t; @@ -2924,7 +2924,7 @@ private CompileResult CompileExpr(Expression expr, List queryArgs) var call = (MethodCallExpression)expr; var args = new CompileResult[call.Arguments.Count]; - var obj = call.Object != null ? CompileExpr(call.Object, queryArgs) : null; + var obj = call.Object is not null ? CompileExpr(call.Object, queryArgs) : null; for (var i = 0; i < args.Length; i++) { @@ -2943,7 +2943,7 @@ private CompileResult CompileExpr(Expression expr, List queryArgs) } else if (call.Method.Name == "Contains" && args.Length == 1) { - if (call.Object != null && call.Object.Type == typeof(string)) + if (call.Object is not null && call.Object.Type == typeof(string)) { sqlCall = "(" + obj.CommandText + " like ('%' || " + args[0].CommandText + " || '%'))"; } @@ -2997,14 +2997,14 @@ private CompileResult CompileExpr(Expression expr, List queryArgs) return new CompileResult { CommandText = valr.CommandText, - Value = valr.Value != null ? ConvertTo(valr.Value, ty) : null + Value = valr.Value is not null ? ConvertTo(valr.Value, ty) : null }; } else if (expr.NodeType == ExpressionType.MemberAccess) { var mem = (MemberExpression)expr; - if (mem.Expression != null && mem.Expression.NodeType == ExpressionType.Parameter) + if (mem.Expression is not null && mem.Expression.NodeType == ExpressionType.Parameter) { // // This is a column of our table, output just the column name @@ -3016,7 +3016,7 @@ private CompileResult CompileExpr(Expression expr, List queryArgs) else { object obj = null; - if (mem.Expression != null) + if (mem.Expression is not null) { var r = CompileExpr(mem.Expression, queryArgs); if (r.Value is null) @@ -3065,7 +3065,7 @@ private CompileResult CompileExpr(Expression expr, List queryArgs) // // Work special magic for enumerables // - if (val != null && val is System.Collections.IEnumerable && !(val is string) && !(val is System.Collections.Generic.IEnumerable)) + if (val is not null && val is System.Collections.IEnumerable && !(val is string) && !(val is System.Collections.Generic.IEnumerable)) { var sb = new System.Text.StringBuilder(); sb.Append("("); @@ -3102,7 +3102,7 @@ static object ConvertTo(object obj, Type t) { Type nut = Nullable.GetUnderlyingType(t); - if (nut != null) + if (nut is not null) { if (obj is null) return null; diff --git a/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs b/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs index 82207ff03..e07542f27 100644 --- a/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs +++ b/src/Akavache.Sqlite3/SqlLiteCache/SqlRawPersistentBlobCache.cs @@ -62,7 +62,7 @@ public DateTimeKind? ForcedDateTimeKind { _dateTimeKind = value; - if (_jsonDateTimeContractResolver != null) + if (_jsonDateTimeContractResolver is not null) { _jsonDateTimeContractResolver.ForceDateTimeKindOverride = value; } @@ -295,7 +295,7 @@ public IObservable InsertObject(string key, T value, DateTimeOffset? ab } /// - public IObservable GetObject(string key) + public IObservable GetObject(string key) { if (_disposed) { @@ -340,12 +340,21 @@ public IObservable> GetAllObjects() return Observable.Throw>(new InvalidOperationException("There is not a valid operation queue")); } - return _initializer.SelectMany(_ => _opQueue.SelectTypes(new[] { typeof(T).FullName }) + var typeFullName = typeof(T).FullName; + + if (typeFullName is null) + { + return Observable.Throw>(new InvalidOperationException("The generic type does not have a valid full name and is required")); + } + + return _initializer.SelectMany(_ => _opQueue.SelectTypes(new[] { typeFullName }) .SelectMany(x => x.ToObservable() #pragma warning disable CS8604 // Possible null reference argument. .SelectMany(y => AfterReadFromDiskFilter(y.Value, Scheduler)) #pragma warning restore CS8604 // Possible null reference argument. .SelectMany(DeserializeObject) + .Where(y => y is not null) + .Select(y => y!) .ToList())) .PublishLast().PermaRef(); } @@ -374,7 +383,14 @@ public IObservable InvalidateAllObjects() return Observable.Throw(new InvalidOperationException("There is not a valid operation queue")); } - return _initializer.SelectMany(_ => _opQueue.InvalidateTypes(new[] { typeof(T).FullName })) + var typeFullName = typeof(T).FullName; + + if (typeFullName is null) + { + return Observable.Throw(new InvalidOperationException("The generic type does not have a valid full name and is required")); + } + + return _initializer.SelectMany(_ => _opQueue.InvalidateTypes(new[] { typeFullName })) .PublishLast().PermaRef(); } @@ -572,7 +588,7 @@ public IObservable> GetObjects(IEnumerable key }) .SelectMany(dict => dict.Select(x => AfterReadFromDiskFilter(x.Value, Scheduler).Select(data => (key: x.Key, data: data)))) .Merge() - .SelectMany(x => DeserializeObject(x.data).Select(obj => (key: x.key, data: obj))) + .SelectMany(x => DeserializeObject(x.data).Where(y => y is not null).Select(obj => (key: x.key, data: obj!))) .ToDictionary(x => x.key, x => x.data) .PublishLast().PermaRef(); } @@ -642,7 +658,8 @@ protected virtual void Dispose(bool isDisposing) _opQueue?.Dispose(); Connection.Dispose(); } - }, Scheduler); + }, + Scheduler); cleanup.Multicast(_shutdown).PermaRef(); } @@ -791,7 +808,7 @@ private byte[] SerializeObject(T value) } } - private IObservable DeserializeObject(byte[] data) + private IObservable DeserializeObject(byte[] data) { var serializer = GetSerializer(); using (var reader = new BsonDataReader(new MemoryStream(data))) diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net461.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net461.approved.txt index 790d352db..5893b9bf9 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net461.approved.txt +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net461.approved.txt @@ -1,3 +1,4 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Drawing")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Mobile")] @@ -163,13 +164,13 @@ namespace Akavache public static class JsonSerializationMixin { public static System.IObservable> GetAllObjects(this Akavache.IBlobCache blobCache) { } - public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } - public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } - public static System.IObservable GetObject(this Akavache.IBlobCache blobCache, string key) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetObject(this Akavache.IBlobCache blobCache, string key) { } public static System.IObservable GetObjectCreatedAt(this Akavache.IBlobCache blobCache, string key) { } - public static System.IObservable GetOrCreateObject(this Akavache.IBlobCache blobCache, string key, System.Func fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } - public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } - public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrCreateObject(this Akavache.IBlobCache blobCache, string key, System.Func fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } public static System.IObservable InsertAllObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } public static System.IObservable InsertObject(this Akavache.IBlobCache blobCache, string key, T value, System.DateTimeOffset? absoluteExpiration = default) { } public static System.IObservable InvalidateAllObjects(this Akavache.IBlobCache blobCache) { } diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net5.0.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net5.0.approved.txt new file mode 100644 index 000000000..92c303645 --- /dev/null +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.net5.0.approved.txt @@ -0,0 +1,269 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Drawing")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Mobile")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Sqlite3")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Tests")] +[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows7.0")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName="")] +[assembly: System.Runtime.Versioning.TargetPlatform("Windows7.0")] +namespace Akavache +{ + public class AkavacheHttpMixin : Akavache.IAkavacheHttpMixin + { + public AkavacheHttpMixin() { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + } + public static class BlobCache + { + public static string ApplicationName { get; set; } + public static System.DateTimeKind? ForcedDateTimeKind { get; set; } + public static Akavache.ISecureBlobCache InMemory { get; set; } + public static Akavache.IBlobCache LocalMachine { get; set; } + public static Akavache.ISecureBlobCache Secure { get; set; } + public static System.Reactive.Concurrency.IScheduler TaskpoolScheduler { get; set; } + public static Akavache.IBlobCache UserAccount { get; set; } + public static void EnsureInitialized() { } + public static System.Threading.Tasks.Task Shutdown() { } + } + public static class BulkOperationsMixin + { + public static System.IObservable> Get(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable> GetCreatedAt(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable> GetObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable Insert(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InsertObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable Invalidate(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + public static System.IObservable InvalidateObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IEnumerable keys) { } + } + public class CacheEntry + { + public CacheEntry(string? typeName, byte[] value, System.DateTimeOffset createdAt, System.DateTimeOffset? expiresAt) { } + public System.DateTimeOffset CreatedAt { get; set; } + public System.DateTimeOffset? ExpiresAt { get; set; } + public string? TypeName { get; set; } + public byte[] Value { get; set; } + } + public enum DataProtectionScope + { + CurrentUser = 0, + } + public static class DependencyResolverMixin + { + public static void InitializeAkavache(this Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + } + public class EncryptionProvider : Akavache.IEncryptionProvider + { + public EncryptionProvider() { } + public System.IObservable DecryptBlock(byte[] block) { } + public System.IObservable EncryptBlock(byte[] block) { } + } + public static class HttpMixinExtensions + { + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default) { } + } + public interface IAkavacheHttpMixin + { + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, string url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable DownloadUrl(Akavache.IBlobCache blobCache, string key, System.Uri url, System.Collections.Generic.IDictionary? headers = null, bool fetchAlways = false, System.DateTimeOffset? absoluteExpiration = default); + } + public interface IBlobCache : System.IDisposable + { + System.DateTimeKind? ForcedDateTimeKind { get; set; } + System.Reactive.Concurrency.IScheduler Scheduler { get; } + System.IObservable Shutdown { get; } + System.IObservable Flush(); + System.IObservable Get(string key); + System.IObservable> GetAllKeys(); + System.IObservable GetCreatedAt(string key); + System.IObservable Insert(string key, byte[] data, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable Invalidate(string key); + System.IObservable InvalidateAll(); + System.IObservable Vacuum(); + } + public interface IBulkBlobCache : Akavache.IBlobCache, System.IDisposable + { + System.IObservable> Get(System.Collections.Generic.IEnumerable keys); + System.IObservable> GetCreatedAt(System.Collections.Generic.IEnumerable keys); + System.IObservable Insert(System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable Invalidate(System.Collections.Generic.IEnumerable keys); + } + public interface IEncryptionProvider + { + System.IObservable DecryptBlock(byte[] block); + System.IObservable EncryptBlock(byte[] block); + } + public interface IFilesystemProvider + { + System.IObservable CreateRecursive(string path); + System.IObservable Delete(string path); + string? GetDefaultLocalMachineCacheDirectory(); + string? GetDefaultRoamingCacheDirectory(); + string? GetDefaultSecretCacheDirectory(); + System.IObservable OpenFileForReadAsync(string path, System.Reactive.Concurrency.IScheduler scheduler); + System.IObservable OpenFileForWriteAsync(string path, System.Reactive.Concurrency.IScheduler scheduler); + } + public interface IKeyedOperationQueue + { + System.IObservable EnqueueObservableOperation(string key, System.Func> asyncCalculationFunc); + System.IObservable EnqueueOperation(string key, System.Action action); + System.IObservable EnqueueOperation(string key, System.Func calculationFunc); + System.IObservable ShutdownQueue(); + } + public interface IObjectBlobCache : Akavache.IBlobCache, System.IDisposable + { + System.IObservable> GetAllObjects(); + System.IObservable GetObject(string key); + System.IObservable GetObjectCreatedAt(string key); + System.IObservable InsertObject(string key, T value, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable InvalidateAllObjects(); + System.IObservable InvalidateObject(string key); + } + public interface IObjectBulkBlobCache : Akavache.IBlobCache, Akavache.IBulkBlobCache, Akavache.IObjectBlobCache, System.IDisposable + { + System.IObservable> GetObjects(System.Collections.Generic.IEnumerable keys); + System.IObservable InsertObjects(System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default); + System.IObservable InvalidateObjects(System.Collections.Generic.IEnumerable keys); + } + public interface ISecureBlobCache : Akavache.IBlobCache, System.IDisposable { } + public class InMemoryBlobCache : Akavache.IBlobCache, Akavache.IObjectBlobCache, Akavache.ISecureBlobCache, Splat.IEnableLogger, System.IDisposable + { + public InMemoryBlobCache() { } + public InMemoryBlobCache(System.Collections.Generic.IEnumerable> initialContents) { } + public InMemoryBlobCache(System.Reactive.Concurrency.IScheduler scheduler) { } + public InMemoryBlobCache(System.Reactive.Concurrency.IScheduler? scheduler, System.Collections.Generic.IEnumerable>? initialContents) { } + public System.DateTimeKind? ForcedDateTimeKind { get; set; } + public System.Reactive.Concurrency.IScheduler Scheduler { get; set; } + public System.IObservable Shutdown { get; } + public void Dispose() { } + protected virtual void Dispose(bool isDisposing) { } + public System.IObservable Flush() { } + public System.IObservable Get(string key) { } + public System.IObservable> GetAllKeys() { } + public System.IObservable> GetAllObjects() { } + public System.IObservable GetCreatedAt(string key) { } + public System.IObservable GetObject(string key) { } + public System.IObservable GetObjectCreatedAt(string key) { } + public System.IObservable Insert(string key, byte[] data, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable InsertObject(string key, T value, System.DateTimeOffset? absoluteExpiration = default) { } + public System.IObservable Invalidate(string key) { } + public System.IObservable InvalidateAll() { } + public System.IObservable InvalidateAllObjects() { } + public System.IObservable InvalidateObject(string key) { } + public System.IObservable Vacuum() { } + public static Akavache.InMemoryBlobCache OverrideGlobals(System.Collections.Generic.IDictionary initialContents, System.Reactive.Concurrency.IScheduler? scheduler = null) { } + public static Akavache.InMemoryBlobCache OverrideGlobals(System.Collections.Generic.IDictionary initialContents, System.Reactive.Concurrency.IScheduler? scheduler = null) { } + public static Akavache.InMemoryBlobCache OverrideGlobals(System.Reactive.Concurrency.IScheduler? scheduler = null, params System.Collections.Generic.KeyValuePair<, >[] initialContents) { } + } + public static class JsonSerializationMixin + { + public static System.IObservable> GetAllObjects(this Akavache.IBlobCache blobCache) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetObject(this Akavache.IBlobCache blobCache, string key) { } + public static System.IObservable GetObjectCreatedAt(this Akavache.IBlobCache blobCache, string key) { } + public static System.IObservable GetOrCreateObject(this Akavache.IBlobCache blobCache, string key, System.Func fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InsertAllObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InsertObject(this Akavache.IBlobCache blobCache, string key, T value, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable InvalidateAllObjects(this Akavache.IBlobCache blobCache) { } + public static System.IObservable InvalidateObject(this Akavache.IBlobCache blobCache, string key) { } + } + public class KeyedOperationQueue : Akavache.IKeyedOperationQueue, Splat.IEnableLogger, System.IDisposable + { + public KeyedOperationQueue(System.Reactive.Concurrency.IScheduler? scheduler = null) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.IObservable EnqueueObservableOperation(string key, System.Func> asyncCalculationFunc) { } + public System.IObservable EnqueueOperation(string key, System.Action action) { } + public System.IObservable EnqueueOperation(string key, System.Func calculationFunc) { } + public System.IObservable ShutdownQueue() { } + } + public class LoginInfo + { + public LoginInfo(string username, string password) { } + public string Password { get; } + public string UserName { get; } + } + public static class LoginMixin + { + public static System.IObservable EraseLogin(this Akavache.ISecureBlobCache blobCache, string host = "default") { } + public static System.IObservable GetLoginAsync(this Akavache.ISecureBlobCache blobCache, string host = "default") { } + public static System.IObservable SaveLogin(this Akavache.ISecureBlobCache blobCache, string user, string password, string host = "default", System.DateTimeOffset? absoluteExpiration = default) { } + } + public static class ProtectedData + { + public static byte[] Protect(byte[] originalData, byte[]? entropy, Akavache.DataProtectionScope scope = 0) { } + public static byte[] Unprotect(byte[] originalData, byte[]? entropy, Akavache.DataProtectionScope scope = 0) { } + } + public static class RelativeTimeMixin + { + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, string url, System.TimeSpan expiration, System.Collections.Generic.Dictionary? headers = null, bool fetchAlways = false) { } + public static System.IObservable DownloadUrl(this Akavache.IBlobCache blobCache, System.Uri url, System.TimeSpan expiration, System.Collections.Generic.Dictionary? headers = null, bool fetchAlways = false) { } + public static System.IObservable Insert(this Akavache.IBlobCache blobCache, string key, byte[] data, System.TimeSpan expiration) { } + public static System.IObservable InsertObject(this Akavache.IBlobCache blobCache, string key, T value, System.TimeSpan expiration) { } + public static System.IObservable SaveLogin(this Akavache.ISecureBlobCache blobCache, string user, string password, string host, System.TimeSpan expiration) { } + } + public class SimpleFilesystemProvider : Akavache.IFilesystemProvider + { + public SimpleFilesystemProvider() { } + public System.IObservable CreateRecursive(string path) { } + public System.IObservable Delete(string path) { } + public string GetDefaultLocalMachineCacheDirectory() { } + public string GetDefaultRoamingCacheDirectory() { } + public string GetDefaultSecretCacheDirectory() { } + public System.IObservable OpenFileForReadAsync(string path, System.Reactive.Concurrency.IScheduler scheduler) { } + public System.IObservable OpenFileForWriteAsync(string path, System.Reactive.Concurrency.IScheduler scheduler) { } + protected static string GetAssemblyDirectoryName() { } + } +} +namespace Akavache.Core +{ + public class Registrations + { + public Registrations() { } + public void Register(Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + } +} +namespace Akavache.Internal +{ + [System.Flags] + public enum FileAccess + { + Read = 1, + Write = 2, + ReadWrite = 3, + } + public enum FileMode + { + CreateNew = 1, + Create = 2, + Open = 3, + OpenOrCreate = 4, + Truncate = 5, + Append = 6, + } + [System.Flags] + public enum FileShare + { + None = 0, + Read = 1, + Write = 2, + ReadWrite = 3, + Delete = 4, + Inheritable = 16, + } +} +namespace System +{ + public static class StreamMixins { } +} \ No newline at end of file diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.netcoreapp3.1.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.netcoreapp3.1.approved.txt index 8c362cf88..d58633d64 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.netcoreapp3.1.approved.txt +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheCore.netcoreapp3.1.approved.txt @@ -1,3 +1,4 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Drawing")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Akavache.Mobile")] @@ -163,13 +164,13 @@ namespace Akavache public static class JsonSerializationMixin { public static System.IObservable> GetAllObjects(this Akavache.IBlobCache blobCache) { } - public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } - public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } - public static System.IObservable GetObject(this Akavache.IBlobCache blobCache, string key) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetAndFetchLatest(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.Func? fetchPredicate = null, System.DateTimeOffset? absoluteExpiration = default, bool shouldInvalidateOnError = false, System.Func? cacheValidationPredicate = null) { } + public static System.IObservable GetObject(this Akavache.IBlobCache blobCache, string key) { } public static System.IObservable GetObjectCreatedAt(this Akavache.IBlobCache blobCache, string key) { } - public static System.IObservable GetOrCreateObject(this Akavache.IBlobCache blobCache, string key, System.Func fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } - public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } - public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrCreateObject(this Akavache.IBlobCache blobCache, string key, System.Func fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable GetOrFetchObject(this Akavache.IBlobCache blobCache, string key, System.Func> fetchFunc, System.DateTimeOffset? absoluteExpiration = default) { } public static System.IObservable InsertAllObjects(this Akavache.IBlobCache blobCache, System.Collections.Generic.IDictionary keyValuePairs, System.DateTimeOffset? absoluteExpiration = default) { } public static System.IObservable InsertObject(this Akavache.IBlobCache blobCache, string key, T value, System.DateTimeOffset? absoluteExpiration = default) { } public static System.IObservable InvalidateAllObjects(this Akavache.IBlobCache blobCache) { } diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net461.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net461.approved.txt index 84a1971b2..c1f5cc76a 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net461.approved.txt +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net461.approved.txt @@ -1,3 +1,4 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] [assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName=".NET Framework 4.6.1")] namespace Akavache { diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net5.0.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net5.0.approved.txt new file mode 100644 index 000000000..be66aea3a --- /dev/null +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.net5.0.approved.txt @@ -0,0 +1,24 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] +[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows7.0")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName="")] +[assembly: System.Runtime.Versioning.TargetPlatform("Windows7.0")] +namespace Akavache +{ + public static class BitmapImageMixin + { + public static System.IObservable LoadImage(this Akavache.IBlobCache blobCache, string key, float? desiredWidth = default, float? desiredHeight = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, string url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, System.Uri url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, string key, string url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable LoadImageFromUrl(this Akavache.IBlobCache blobCache, string key, System.Uri url, bool fetchAlways = false, float? desiredWidth = default, float? desiredHeight = default, System.DateTimeOffset? absoluteExpiration = default) { } + public static System.IObservable ThrowOnBadImageBuffer(byte[] compressedImage) { } + } +} +namespace Akavache.Drawing +{ + public class Registrations + { + public Registrations() { } + public void Register(Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + } +} \ No newline at end of file diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.netcoreapp3.1.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.netcoreapp3.1.approved.txt index 006ba5529..8359d8e3a 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.netcoreapp3.1.approved.txt +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheDrawing.netcoreapp3.1.approved.txt @@ -1,3 +1,4 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] [assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v3.1", FrameworkDisplayName="")] namespace Akavache { diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net461.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net461.approved.txt index 99d0c4fb2..6126282ea 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net461.approved.txt +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net461.approved.txt @@ -1,3 +1,4 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] [assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName=".NET Framework 4.6.1")] namespace Akavache { diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net5.0.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net5.0.approved.txt new file mode 100644 index 000000000..119672135 --- /dev/null +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.net5.0.approved.txt @@ -0,0 +1,19 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName="")] +namespace Akavache +{ + public class Registrations + { + public Registrations() { } + public void Register(Splat.IMutableDependencyResolver resolver, Splat.IReadonlyDependencyResolver readonlyDependencyResolver) { } + public static void Start(string applicationName) { } + } +} +namespace Akavache.Sqlite3 +{ + public static class LinkerPreserve { } + public class SQLitePersistentBlobCache : Akavache.Sqlite3.SqlRawPersistentBlobCache + { + public SQLitePersistentBlobCache(string databaseFile, System.Reactive.Concurrency.IScheduler? scheduler = null) { } + } +} \ No newline at end of file diff --git a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.netcoreapp3.1.approved.txt b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.netcoreapp3.1.approved.txt index a2edc3bec..b65900cc5 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.netcoreapp3.1.approved.txt +++ b/src/Akavache.Tests/API/ApiApprovalTests.AkavacheProject.netcoreapp3.1.approved.txt @@ -1,3 +1,4 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/akavache")] [assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName="")] namespace Akavache { diff --git a/src/Akavache.Tests/API/ApiApprovalTests.cs b/src/Akavache.Tests/API/ApiApprovalTests.cs index 6f9878fcc..d28306787 100644 --- a/src/Akavache.Tests/API/ApiApprovalTests.cs +++ b/src/Akavache.Tests/API/ApiApprovalTests.cs @@ -100,7 +100,8 @@ private static string Filter(string text) new[] { Environment.NewLine - }, StringSplitOptions.RemoveEmptyEntries) + }, + StringSplitOptions.RemoveEmptyEntries) .Where(l => !l.StartsWith("[assembly: AssemblyVersion(", StringComparison.InvariantCulture) && !l.StartsWith("[assembly: AssemblyFileVersion(", StringComparison.InvariantCulture) && diff --git a/src/Akavache.Tests/Akavache.Tests.csproj b/src/Akavache.Tests/Akavache.Tests.csproj index e36ab4789..9f3a46ca7 100644 --- a/src/Akavache.Tests/Akavache.Tests.csproj +++ b/src/Akavache.Tests/Akavache.Tests.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - $(TargetFrameworks);net461 + $(TargetFrameworks);net5.0-windows $(NoWarn);CA1307;CA2000;CA1062 latest diff --git a/src/Akavache.Tests/Fixtures/FakeDateTimeHighPrecisionJsonConverter.cs b/src/Akavache.Tests/Fixtures/FakeDateTimeHighPrecisionJsonConverter.cs index b6d33708b..75d7748ab 100644 --- a/src/Akavache.Tests/Fixtures/FakeDateTimeHighPrecisionJsonConverter.cs +++ b/src/Akavache.Tests/Fixtures/FakeDateTimeHighPrecisionJsonConverter.cs @@ -43,7 +43,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist /// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { - if (value != null) + if (value is not null) { var dateTime = value is DateTime dt ? dt : ((DateTime?)value).Value; serializer.Serialize(writer, dateTime.ToUniversalTime().Ticks); diff --git a/src/Akavache.Tests/SqliteBlobCacheExtensionsTests.cs b/src/Akavache.Tests/SqliteBlobCacheExtensionsTests.cs index a6de9b85a..ac725d990 100644 --- a/src/Akavache.Tests/SqliteBlobCacheExtensionsTests.cs +++ b/src/Akavache.Tests/SqliteBlobCacheExtensionsTests.cs @@ -49,7 +49,7 @@ public void VacuumCompactsDatabase() fixture.Vacuum().Wait(); } - Assert.True(new FileInfo(dbPath).Length < size); + Assert.True(new FileInfo(dbPath).Length <= size); } } diff --git a/src/Akavache.Tests/TestBases/BlobCacheExtensionsTestBase.cs b/src/Akavache.Tests/TestBases/BlobCacheExtensionsTestBase.cs index 3a3ed8dda..4905f85ef 100644 --- a/src/Akavache.Tests/TestBases/BlobCacheExtensionsTestBase.cs +++ b/src/Akavache.Tests/TestBases/BlobCacheExtensionsTestBase.cs @@ -555,7 +555,7 @@ public async Task GetAndFetchLatestValidatesItemsToBeCached() // GetAndFetchLatest skips cache invalidation/storage due to cache validation predicate. await fixture.InsertObject(key, items); - await fixture.GetAndFetchLatest(key, fetcher, cacheValidationPredicate: i => i != null && i.Any()).LastAsync(); + await fixture.GetAndFetchLatest(key, fetcher, cacheValidationPredicate: i => i is not null && i.Any()).LastAsync(); var result = await fixture.GetObject>(key).FirstAsync(); diff --git a/src/Akavache/Akavache.Sqlite3.BundleE.csproj b/src/Akavache/Akavache.Sqlite3.BundleE.csproj index 97eb3af2f..50f461eb4 100644 --- a/src/Akavache/Akavache.Sqlite3.BundleE.csproj +++ b/src/Akavache/Akavache.Sqlite3.BundleE.csproj @@ -1,7 +1,7 @@  - netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;tizen40 + netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid10.0;tizen40 $(TargetFrameworks);net461;uap10.0.16299 Akavache Akavache diff --git a/src/Akavache/Akavache.csproj b/src/Akavache/Akavache.csproj index fbfffa2dd..803ca5f3e 100644 --- a/src/Akavache/Akavache.csproj +++ b/src/Akavache/Akavache.csproj @@ -1,7 +1,7 @@  - netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid90;tizen40 + netstandard2.0;Xamarin.iOS10;Xamarin.Mac20;MonoAndroid10.0;tizen40;net5.0 $(TargetFrameworks);net461;uap10.0.16299 Akavache Akavache diff --git a/src/Directory.build.props b/src/Directory.build.props index 8209a65a4..b2804c975 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -37,7 +37,7 @@ - + diff --git a/version.json b/version.json index 400837ed0..e708eeb62 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "7.1", + "version": "7.2", "publicReleaseRefSpec": [ "^refs/heads/main$", // we release out of master "^refs/heads/develop$", // we release out of develop