From 3de25ee4b31b3382b3632cd9f99656dd53971d38 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Wed, 8 Jan 2020 00:06:58 +0800 Subject: [PATCH] Refactor to use ABP converter and comparer --- .../Modeling/AbpEntityTypeBuilderExtensions.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs index b1e59a6c95..dceaeaf74f 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs @@ -1,11 +1,12 @@ using System; using System.Collections.Generic; -using System.Linq; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Volo.Abp.Auditing; using Volo.Abp.Data; using Volo.Abp.Domain.Entities; +using Volo.Abp.EntityFrameworkCore.ValueComparers; +using Volo.Abp.EntityFrameworkCore.ValueConverters; using Volo.Abp.MultiTenancy; namespace Volo.Abp.EntityFrameworkCore.Modeling @@ -57,10 +58,8 @@ namespace Volo.Abp.EntityFrameworkCore.Modeling { b.Property>(nameof(IHasExtraProperties.ExtraProperties)) .HasColumnName(nameof(IHasExtraProperties.ExtraProperties)) - .ConfigureJsonConversionWithValueComparer( - (d1, d2) => d1.SequenceEqual(d2), - d => d.Aggregate(0, (k, v) => HashCode.Combine(k, v.GetHashCode())), - d => d.ToDictionary(k => k.Key, v => v.Value)); + .HasConversion(new AbpJsonValueConverter>()) + .Metadata.SetValueComparer(new AbpDictionaryValueComparer()); } }