From d6f15af6b6045b79bcd67746b8918b3351650837 Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 8 May 2020 17:05:57 -0400 Subject: [PATCH] Fixed: Command Inherited Properties not Saved to DB --- src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs | 6 ++++-- .../Datastore/Converters/EmbeddedDocumentConverter.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs b/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs index 37271bdab..e2f77c6f0 100644 --- a/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/CommandConverter.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.Text.Json; using NzbDrone.Common.Extensions; using NzbDrone.Common.Reflection; @@ -39,7 +39,9 @@ public override Command Parse(object value) public override void SetValue(IDbDataParameter parameter, Command value) { - parameter.Value = value == null ? null : JsonSerializer.Serialize(value, SerializerSettings); + // Cast to object to get all properties written out + // https://github.com/dotnet/corefx/issues/38650 + parameter.Value = value == null ? null : JsonSerializer.Serialize((object)value, SerializerSettings); } } } diff --git a/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs b/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs index af8e48fb3..6b6744110 100644 --- a/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs @@ -1,4 +1,4 @@ -using System.Data; +using System.Data; using System.Text.Json; using System.Text.Json.Serialization; using Dapper; @@ -39,7 +39,9 @@ public EmbeddedDocumentConverter(params JsonConverter[] converters) public override void SetValue(IDbDataParameter parameter, T value) { - parameter.Value = JsonSerializer.Serialize(value, SerializerSettings); + // Cast to object to get all properties written out + // https://github.com/dotnet/corefx/issues/38650 + parameter.Value = JsonSerializer.Serialize((object)value, SerializerSettings); } public override T Parse(object value)