Skip to content

Commit

Permalink
Allowed to read list of parameters from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
crisfervil committed Aug 30, 2018
1 parent 7a8def4 commit 71fd9cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 17 additions & 2 deletions src/XrmCommandBox/CommandOptionsSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Xml;
using log4net;
using log4net;
using System.Collections.Generic;
using System.Xml;

namespace XrmCommandBox
{
Expand All @@ -21,8 +22,22 @@ public void Deserialize(CommonOptions options)
var configOptionName = configNode.Name;
var optionProperty = options.GetType().GetProperty(configOptionName);
if (optionProperty != null)
{
if (optionProperty.PropertyType == typeof(string))
{
optionProperty.SetValue(options, configNode.InnerXml);
}
else if (optionProperty.PropertyType == typeof(IEnumerable<string>))
{
var values = new List<string>();
// find child nodes
foreach (XmlNode valueNode in configNode.ChildNodes)
{
values.Add(valueNode.InnerXml);
}
optionProperty.SetValue(options, values);
}
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/XrmCommandBox/Tools/LookupTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public void Run(LookupToolOptions options)
var dataTable = serializer.Deserialize(options.File);
_log.Info($"Read {dataTable.Count} {dataTable.Name} records");



foreach (var record in dataTable)
{
try
Expand Down

0 comments on commit 71fd9cd

Please sign in to comment.