Skip to content

Commit

Permalink
minor fix from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Lillie Dae <[email protected]>
  • Loading branch information
lillie-dae committed Nov 20, 2023
1 parent 08cffa6 commit e29490b
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/Api/Hl7ApplicationConfigEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ public IEnumerable<string> Validate()
if (DataMapping.IsNullOrEmpty())
errors.Add($"{nameof(DataMapping)} is missing values.");

ValidateDataMapping(errors);

return errors;
}

private void ValidateDataMapping(List<string> errors)
{
for (var idx = 0; idx < DataMapping.Count; idx++)
{
var dataMapKvp = DataMapping.ElementAt(idx);
var dataMapKvp = DataMapping[idx];

if (string.IsNullOrWhiteSpace(dataMapKvp.Key) || dataMapKvp.Value.Length < 8)
{
Expand All @@ -85,8 +92,6 @@ public IEnumerable<string> Validate()
errors.Add($"DataMapping.Value is not a valid DICOM Tag. {e.Message}");
}
}

return errors;
}

public override string ToString()
Expand All @@ -107,12 +112,6 @@ public static implicit operator StringKeyValuePair(KeyValuePair<string, string>
return new StringKeyValuePair { Key = kvp.Key, Value = kvp.Value };
}

[EditorBrowsable(EditorBrowsableState.Never)]
public void Deconstruct(out string key, out string value)
{
key = Key;
value = Value;
}
public static List<StringKeyValuePair> FromDictionary(Dictionary<string, string> dictionary) =>
dictionary.Select(kvp => new StringKeyValuePair { Key = kvp.Key, Value = kvp.Value }).ToList();

Expand All @@ -128,9 +127,6 @@ public static implicit operator DataKeyValuePair(KeyValuePair<string, DataLinkTy
{
return new DataKeyValuePair { Key = kvp.Key, Value = kvp.Value };
}

public static List<DataKeyValuePair> FromDictionary(Dictionary<string, DataLinkType> dictionary) =>
dictionary.Select(kvp => new DataKeyValuePair { Key = kvp.Key, Value = kvp.Value }).ToList();
}

public interface IKeyValuePair<TKey, TValue>
Expand Down

0 comments on commit e29490b

Please sign in to comment.