public XElement BatchDeleteAttributes(string domain, params object[] items)
{
if (items.Length < 1)
{
throw new ArgumentOutOfRangeException ("Must delete at least 1 item");
}
var values = new NameValueCollection
{
{"Action","BatchDeleteAttributes"},
{"DomainName", domain},
};
int itemCount = 0;
try
{
foreach (dynamic item in items)
{
if (itemCount >= 25)
{
throw new SimpleDbException("Batch delete is limited to 25 items per request");
}
values.Add(
string.Format("Item.{0}.ItemName", itemCount),
item.Name);
if (ObjectExtensions.HasMember(item, "Attributes"))
{
int attributeCount = 0;
foreach (dynamic attribute in item.Attributes)
{
values.Add(
string.Format("Item.{0}.Attribute.{1}.Name", itemCount, attributeCount),
attribute.Name);
attributeCount++;
}
}
itemCount++;
}
}
catch (Exception ex)
{
throw new FormatException("One or more item definitions did not contain the expected properties", ex);
}
return InternalExecute(values);
}