在N2 CMS中,有没有办法以编程方式从垃圾箱中删除节点?
答案 0 :(得分:0)
我明白了。在此示例中,TargetDetailModel类型的模型将从N2 CMS垃圾箱中永久删除。
var trash = new ItemList<TrashContainerItem>(N2.Find.RootItem.Children, new TypeFilter(typeof(TrashContainerItem))).FirstOrDefault();
if (trash != null)
{
var detailToPermDelete = new ItemList<TargetDetailModel>(trash.Children, new TypeFilter(typeof(TargetDetailModel)));
for (int permDeleteCount = 0; permDeleteCount < detailToPermDelete.Count; permDeleteCount++)
{
N2.Context.Current.Persister.Delete(detailToPermDelete.ElementAt(permDeleteCount));
}
}