Hi,
For legacy reasons we had 106 service custom properties in our production cluster, I've carried out an audit of which aren't in use anymore, where I've removed 50 from the cluster.
Some services are still returning an empty string array via the API for the properties that have been removed, looking in the Service.xml file where one of the deleted properties are still showing up, I can see it exists, with value="".
How can I purge the remaining remanence of these properties from the services?
Hi Philip,
You can remove them with the following code in an automation script, you just need to adapt for your services and list of properties.
var propertiesToRemove = new[] { "Property1", "Property2" };
var service = engine.FindService("Test Service");
var serviceInfo = service.ServiceInfo;
serviceInfo.Properties = serviceInfo.Properties.Where(x => !propertiesToRemove.Contains(x.Name, StringComparer.InvariantCultureIgnoreCase)).ToArray();
var addServiceMessage = new AddServiceMessage
{
DataMinerID = serviceInfo.DataMinerID,
HostingDataMinerID = serviceInfo.HostingAgentID,
Service = serviceInfo,
};
var dmsMessage = engine.SendSLNetSingleResponseMessage(addServiceMessage);
Thanks Jorge, that worked.