mirror of https://github.com/abpframework/abp.git
committed by
GitHub
20 changed files with 97 additions and 80 deletions
@ -1,17 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Microsoft.EntityFrameworkCore.ChangeTracking; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.ValueComparers |
|||
{ |
|||
public class AbpDictionaryValueComparer<TKey, TValue> : ValueComparer<Dictionary<TKey, TValue>> |
|||
public class ExtraPropertyDictionaryValueComparer : ValueComparer<ExtraPropertyDictionary> |
|||
{ |
|||
public AbpDictionaryValueComparer() |
|||
public ExtraPropertyDictionaryValueComparer() |
|||
: base( |
|||
(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)) |
|||
d => new ExtraPropertyDictionary(d)) |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.Data |
|||
{ |
|||
[Serializable] |
|||
public class ExtraPropertyDictionary : Dictionary<string, object> |
|||
{ |
|||
public ExtraPropertyDictionary() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ExtraPropertyDictionary(IDictionary<string, object> dictionary) |
|||
: base(dictionary) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +1,9 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.Data |
|||
namespace Volo.Abp.Data |
|||
{ |
|||
//TODO: Move to Volo.Abp.Data.ObjectExtending namespace at 4.0?
|
|||
|
|||
public interface IHasExtraProperties |
|||
{ |
|||
Dictionary<string, object> ExtraProperties { get; } |
|||
ExtraPropertyDictionary ExtraProperties { get; } |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue