在 N2 CMS 中,有没有办法以编程方式从垃圾箱中删除节点?
问问题
317 次
1 回答
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));
}
}
于 2012-12-16T10:02:48.037 回答