vscode-apimanagement
vscode-apimanagement copied to clipboard
set-variable using C# Code not Colour Coded Correctly after Escaping Double Quotes
The problem starts here when I am escaping the double quote:
Set Variable policy:
<set-variable name="queryString" value="@{
string returnValue = string.Empty;
// Add query
string searchQuery = string.Empty;
if (false == string.IsNullOrEmpty(searchQuery))
{
returnValue += "&q=" + searchQuery;
}
// Add finder
string finder = string.Empty;
if (false == string.IsNullOrWhiteSpace(context.Variables.GetValueOrDefault<string>("customerAccountNumber")))
{
if (false == string.IsNullOrEmpty(finder)) { finder += ","; }
finder += "BillToCustomerNumber=\"" + context.Variables.GetValueOrDefault<string>("customerAccountNumber") + "\"";
}
if (false == string.IsNullOrWhiteSpace(context.Variables.GetValueOrDefault<string>("transactionType")))
{
if (!string.IsNullOrEmpty(finder)) { finder += ","; }
finder += "TransactionType=\"" + context.Variables.GetValueOrDefault<string>("transactionType") + "\"";
}
if (false == string.IsNullOrEmpty(finder))
{
if (false == string.IsNullOrEmpty(returnValue)) { returnValue += "&"; }
returnValue += "finder=invoiceSearch;" + finder;
}
// Add only data
if (false == string.IsNullOrEmpty(returnValue)) { returnValue += "&"; }
if (false == string.IsNullOrWhiteSpace(context.Variables.GetValueOrDefault<string>("onlyData")))
{
returnValue += "onlyData=" + context.Variables.GetValueOrDefault<string>("onlyData");
}
else
{
returnValue += "onlyData=true";
}
// Add limit
if (false == string.IsNullOrEmpty(returnValue)) { returnValue += "&"; }
if (false == string.IsNullOrWhiteSpace(context.Variables.GetValueOrDefault<string>("limit")))
{
returnValue += "limit=" + context.Variables.GetValueOrDefault<string>("limit");
}
else
{
returnValue += "limit=500";
}
// Add fields
if (false == string.IsNullOrEmpty(returnValue)) { returnValue += "&"; }
if (false == string.IsNullOrWhiteSpace(context.Variables.GetValueOrDefault<string>("fields")))
{
returnValue += "fields=" + context.Variables.GetValueOrDefault<string>("fields");
}
else
{
returnValue += "fields=BillToCustomerNumber,CustomerTransactionId,TransactionType,DueDate,InvoiceCurrencyCode,TransactionNumber,TransactionDate,BillToSite,EnteredAmount,InvoiceBalanceAmount;receivablesInvoiceInstallments:InstallmentId,InstallmentSequenceNumber,InstallmentDueDate,OriginalAmount,PaymentDaysLate,InstallmentBalanceDue,InstallmentStatus,AccountedBalanceDue,InstallmentAmountAdjusted,InstallmentLineAmountOriginal,InstallmentLineAmountDue";
}
// Add expand
if (false == string.IsNullOrEmpty(returnValue)) { returnValue += "&"; }
if (false == string.IsNullOrWhiteSpace(context.Variables.GetValueOrDefault<string>("expand")))
{
returnValue += "expand=" + context.Variables.GetValueOrDefault<string>("expand");
}
else
{
returnValue += "expand=receivablesInvoiceInstallments";
}
return returnValue;
}" />