diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-10-27 13:52:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-27 13:52:08 -0400 |
| commit | 53ee78170ad3d5d5d0ecac2dbe8dcbfb13940e46 (patch) | |
| tree | 1ad4126058814609352d41b78662fd5838d6677a /Emby.Server.Implementations/Data/SqliteUserRepository.cs | |
| parent | 2cdf5c203a9335100b19b9609a738e1b64d6631d (diff) | |
| parent | c9f4a74af02e08b895cd6a8b8a408b1c0edfb6c4 (diff) | |
Merge branch 'master' into copr-fix
Diffstat (limited to 'Emby.Server.Implementations/Data/SqliteUserRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteUserRepository.cs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteUserRepository.cs b/Emby.Server.Implementations/Data/SqliteUserRepository.cs index 11629b389..80fe278f8 100644 --- a/Emby.Server.Implementations/Data/SqliteUserRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserRepository.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.IO; +using System.Text.Json; +using MediaBrowser.Common.Json; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; using SQLitePCL.pretty; @@ -15,15 +16,14 @@ namespace Emby.Server.Implementations.Data /// </summary> public class SqliteUserRepository : BaseSqliteRepository, IUserRepository { - private readonly IJsonSerializer _jsonSerializer; + private readonly JsonSerializerOptions _jsonOptions; public SqliteUserRepository( ILogger<SqliteUserRepository> logger, - IServerApplicationPaths appPaths, - IJsonSerializer jsonSerializer) + IServerApplicationPaths appPaths) : base(logger) { - _jsonSerializer = jsonSerializer; + _jsonOptions = JsonDefaults.GetOptions();; DbFilePath = Path.Combine(appPaths.DataPath, "users.db"); } @@ -84,7 +84,7 @@ namespace Emby.Server.Implementations.Data } user.Password = null; - var serialized = _jsonSerializer.SerializeToBytes(user); + var serialized = JsonSerializer.SerializeToUtf8Bytes(user, _jsonOptions); connection.RunInTransaction(db => { @@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException(nameof(user)); } - var serialized = _jsonSerializer.SerializeToBytes(user); + var serialized = JsonSerializer.SerializeToUtf8Bytes(user, _jsonOptions); using (var connection = GetConnection()) { @@ -142,7 +142,7 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException(nameof(user)); } - var serialized = _jsonSerializer.SerializeToBytes(user); + var serialized = JsonSerializer.SerializeToUtf8Bytes(user, _jsonOptions); using (var connection = GetConnection()) { @@ -179,7 +179,7 @@ namespace Emby.Server.Implementations.Data var id = row[0].ToInt64(); var guid = row[1].ReadGuidFromBlob(); - var user = _jsonSerializer.DeserializeFromString<User>(row.GetString(2)); + var user = JsonSerializer.Deserialize<User>(row[2].ToBlob(), _jsonOptions); user.InternalId = id; user.Id = guid; return user; |
