diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2019-11-10 16:51:54 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-10 16:51:54 +0900 |
| commit | f51f59d675e863ae5537416dbebfb2fd738e7a63 (patch) | |
| tree | 90b11e7294e74051745430ce56e22a7fba9773c4 /Emby.Server.Implementations/Data/SqliteItemRepository.cs | |
| parent | 522df3196dcf3980d20a86a36b2ef90f10c6493a (diff) | |
| parent | 846857b60eb795fc7fd7384b24be5ce4737d65d8 (diff) | |
Merge pull request #1965 from Bond-009/dbjson
Deserialize with the correct type (and warning fixes)
Diffstat (limited to 'Emby.Server.Implementations/Data/SqliteItemRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteItemRepository.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 33402f0e3..65f8a915f 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -3,10 +3,8 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using System.Runtime.Serialization; using System.Text; using System.Text.Json; -using System.Text.Json.Serialization; using System.Threading; using Emby.Server.Implementations.Playlists; using MediaBrowser.Common.Json; @@ -28,7 +26,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; using SQLitePCL.pretty; @@ -659,12 +656,14 @@ namespace Emby.Server.Implementations.Data private void SaveItem(BaseItem item, BaseItem topParent, string userDataKey, IStatement saveItemStatement) { + Type type = item.GetType(); + saveItemStatement.TryBind("@guid", item.Id); - saveItemStatement.TryBind("@type", item.GetType().FullName); + saveItemStatement.TryBind("@type", type.FullName); - if (TypeRequiresDeserialization(item.GetType())) + if (TypeRequiresDeserialization(type)) { - saveItemStatement.TryBind("@data", JsonSerializer.SerializeToUtf8Bytes(item, _jsonOptions)); + saveItemStatement.TryBind("@data", JsonSerializer.SerializeToUtf8Bytes(item, type, _jsonOptions)); } else { |
