2012-12-15 61 views

回答

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)); 
    } 
}