로직 개선
This commit is contained in:
@@ -8,8 +8,25 @@ using System.Linq;
|
||||
|
||||
namespace UVC.Data
|
||||
{
|
||||
public class DataObject : Dictionary<string, object>, IDataObject
|
||||
public class DataObject : SortedDictionary<string, object>, IDataObject
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 객체의 고유 식별자를 나타내는 속성입니다. DataArray에서 데이터를 식별하는 데 사용됩니다.
|
||||
/// </summary>
|
||||
public string Id { get => (IdKey != null && ContainsKey(IdKey)) ? this[IdKey].ToString() : this.First().Value.ToString(); }
|
||||
|
||||
/// <summary>
|
||||
/// Id에 해당하는 key 문자열
|
||||
/// </summary>
|
||||
internal string? IdKey { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// DataObject의 이름을 나타내는 속성입니다.
|
||||
/// </summary>
|
||||
public string Name { get; internal set; } = string.Empty;
|
||||
|
||||
|
||||
// 직접적인 변경이 있었던 키를 저장하는 리스트
|
||||
protected List<string> changedProperies = new List<string>();
|
||||
|
||||
@@ -24,7 +41,7 @@ namespace UVC.Data
|
||||
/// <summary>
|
||||
/// 기본 생성자입니다. 빈 데이터 객체를 생성합니다.
|
||||
/// </summary>
|
||||
public DataObject() {}
|
||||
public DataObject() { }
|
||||
|
||||
/// <summary>
|
||||
/// JObject로부터 데이터 객체를 생성합니다.
|
||||
@@ -320,7 +337,7 @@ namespace UVC.Data
|
||||
changedProperies.Clear();
|
||||
foreach (var keyValue in (DataObject)other)
|
||||
{
|
||||
if(!this.ContainsKey(keyValue.Key) || !this[keyValue.Key].Equals(keyValue.Value))
|
||||
if (!this.ContainsKey(keyValue.Key) || !this[keyValue.Key].Equals(keyValue.Value))
|
||||
{
|
||||
this[keyValue.Key] = keyValue.Value;
|
||||
changedProperies.Add(keyValue.Key);
|
||||
|
||||
Reference in New Issue
Block a user