diff --git a/MarkMpn.Sql4Cds/PluginControl.cs b/MarkMpn.Sql4Cds/PluginControl.cs index 36335091..a9c7c1a6 100644 --- a/MarkMpn.Sql4Cds/PluginControl.cs +++ b/MarkMpn.Sql4Cds/PluginControl.cs @@ -314,7 +314,6 @@ public void OnIncomingMessage(MessageBusEventArgs message) if (param.TryGetValue("FetchXml", out var xml) && xml is string xmlStr && !String.IsNullOrEmpty(xmlStr)) { - var fetch = DeserializeFetchXml(xmlStr); var options = new FetchXml2SqlOptions(); if ((bool)param["ConvertOnly"]) @@ -338,11 +337,13 @@ public void OnIncomingMessage(MessageBusEventArgs message) } catch { + var fetch = DeserializeFetchXml(xmlStr); sql = FetchXml2Sql.Convert(con.ServiceClient, metadata, fetch, options, out _); } } else { + var fetch = DeserializeFetchXml(xmlStr); sql = FetchXml2Sql.Convert(con.ServiceClient, metadata, fetch, options, out _); }