You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
761 B
23 lines
761 B
using System.Data;
|
|
using System.Text.Json;
|
|
using NzbDrone.Core.ThingiProvider;
|
|
|
|
namespace NzbDrone.Core.Datastore.Converters
|
|
{
|
|
public class ProviderSettingConverter : EmbeddedDocumentConverter<IProviderConfig>
|
|
{
|
|
public override IProviderConfig Parse(object value)
|
|
{
|
|
// We can't deserialize based on another column, happens in ProviderRepository instead
|
|
return null;
|
|
}
|
|
|
|
public override void SetValue(IDbDataParameter parameter, IProviderConfig value)
|
|
{
|
|
// Cast to object to get all properties written out
|
|
// https://github.com/dotnet/corefx/issues/38650
|
|
parameter.Value = JsonSerializer.Serialize((object)value, SerializerSettings);
|
|
}
|
|
}
|
|
}
|