#11: update setValue method to handle enumerables

pull/26/head
Simon Gockner 6 years ago
parent 6aeffa85ee
commit 0f9531cfb5
  1. 10
      GBase/DataHandling/XmlDataHandler.cs
  2. 7
      GBase/GBase.xml

@ -3,12 +3,14 @@
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using GBase.DataHandling.Cache.Factories;
using GBase.DataHandling.Factories;
using GBase.Helpers;
using GBase.Interfaces.DataHandling;
using GBase.Interfaces.DataHandling.Xml;
using GBase.Interfaces.DataHandling.Xml.Cache;
@ -97,8 +99,14 @@ namespace GBase.DataHandling
if (value == null)
return;
string valueString;
if (typeof(TProperty) != typeof(string) && value is IEnumerable enumerable)
valueString = enumerable.ToGBaseString();
else
valueString = value.ToString();
await _cache.SetValue<T, TProperty>(propertyName, value, _overwrite);
await _xmlDataWriter.Write<T, TProperty>(propertyName, value.ToString(), _overwrite);
await _xmlDataWriter.Write<T, TProperty>(propertyName, valueString, _overwrite);
}
/// <summary>

@ -532,6 +532,13 @@
</summary>
<returns>A <see cref="T:System.Threading.Tasks.ValueTask"/> to await</returns>
</member>
<member name="M:GBase.Helpers.Enumerables.ToGBaseString(System.Collections.IEnumerable)">
<summary>
Convert an <see cref="T:System.Collections.IEnumerable"/> to a GBase <see cref="T:System.String"/>
</summary>
<param name="enumerable">The <see cref="T:System.Collections.IEnumerable"/></param>
<returns></returns>
</member>
<member name="T:GBase.Installers.DataHandlingInstaller">
<summary>
<see cref="T:LightweightIocContainer.Interfaces.Installers.IIocInstaller"/> for the data handling

Loading…
Cancel
Save