public TEntity Delete(string id) { try { var item = dbSet.Find(id.ToInt()); if (item == null) { return(null); } GetChildren(item); if (item.Children != null && item.Children.Count > 0)//不能删除有子物体的节点 { //throw new Exception("Have Children !"); } else { dbSet.Remove(item); } return(item.ToTModel()); } catch (System.Exception ex) { Log.Error(tag, "Delete", ex.ToString()); return(null); } }
public TEntity Delete(string id) { var item = dbSet.Find(id.ToInt()); GetChildren(item); if (item.Children != null && item.Children.Count > 0)//不能删除有子物体的节点 { //throw new Exception("Have Children !"); } else { dbSet.Remove(item); } return(item.ToTModel()); }