IGNITE-5354 .NET: Fix command line args preference over config file This closes #2042
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8476a195 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8476a195 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8476a195 Branch: refs/heads/ignite-5075 Commit: 8476a1958a1778a6b48dea55a81e8e954f243179 Parents: e36c02c Author: Pavel Tupitsyn <[email protected]> Authored: Wed May 31 12:10:58 2017 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Wed May 31 12:10:58 2017 +0300 ---------------------------------------------------------------------- .../platforms/dotnet/Apache.Ignite/Config/Configurator.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/8476a195/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs b/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs index 785334a..4c43841 100644 --- a/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs +++ b/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs @@ -176,9 +176,12 @@ namespace Apache.Ignite.Config /// </summary> private static string FindValue(IEnumerable<Tuple<string, string>> args, string name) { - return args.Where(x => name.Equals(x.Item1, StringComparison.OrdinalIgnoreCase)) - .Select(x => x.Item2) - .FirstOrDefault(); + // Search in reverse so that command line has preference over config file. + return args + .Reverse() + .Where(x => name.Equals(x.Item1, StringComparison.OrdinalIgnoreCase)) + .Select(x => x.Item2) + .FirstOrDefault(); } } }
