From a171a44db862638d3876fbfe4ab699f13daccb7f Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Tue, 20 Oct 2020 12:06:00 +0100 Subject: [PATCH] Generic IgnoreAlias setting for all handlers - stops them being imported completely. #178 --- .../SyncHandlers/SyncHandlerRoot.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/uSync8.BackOffice/SyncHandlers/SyncHandlerRoot.cs b/uSync8.BackOffice/SyncHandlers/SyncHandlerRoot.cs index 63fa893f..1f53a815 100644 --- a/uSync8.BackOffice/SyncHandlers/SyncHandlerRoot.cs +++ b/uSync8.BackOffice/SyncHandlers/SyncHandlerRoot.cs @@ -576,6 +576,22 @@ virtual protected bool ShouldImport(XElement node, HandlerSettings config) return false; } } + + + // Ignore alias setting. + // if its set the thing with this alias is ignored. + var ignore = config.GetSetting("IgnoreAliases", string.Empty); + if (!string.IsNullOrWhiteSpace(ignore)) + { + var ignoreList = ignore.ToDelimitedList(); + if (ignoreList.InvariantContains(node.GetAlias())) + { + logger.Debug(handlerType, "Ignore: Item {alias} is in the ignore list", node.GetAlias()); + return false; + } + } + + return true; }