Implement generic AbpJsonValueConverter

pull/2462/head
Aaron Chong 5 years ago
parent 59ade77831
commit e754f3350f

@ -0,0 +1,16 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Newtonsoft.Json;
namespace Volo.Abp.EntityFrameworkCore.ValueConverters
{
public class AbpJsonValueConverter<TPropertyType> : ValueConverter<TPropertyType, string>
{
public AbpJsonValueConverter()
: base(
d => JsonConvert.SerializeObject(d, Formatting.None),
s => JsonConvert.DeserializeObject<TPropertyType>(s))
{
}
}
}
Loading…
Cancel
Save