标签:response lis guid null each info ring 收藏 ssi
一个Session
foreach (var item in favoriteId) { if (!string.IsNullOrEmpty(item)) { var favorite = _session.Get<Favorite>(Guid.Parse(item)); if (favorite != null) { // 删除资源 var favoriteList = _session.CreateCriteria<Favorite>().Add(Restrictions.Eq("ResId", favorite.ResId)).List(); if (favoriteList != null && favoriteList.Count <= 1) { _session.Delete(new FavoriteResourceInfo { ResId = favorite.ResId }); } // 删除关联 var favoriteLabelList = _session.CreateCriteria<FavoriteLabel>().Add(Restrictions.Eq("FavoriteId", Guid.Parse(item))).List<FavoriteLabel>(); //relationResponse.GetRelationByFavoriteId(Guid.Parse(item)); if (favoriteLabelList != null && favoriteLabelList.Count > 0) foreach (var favoriteLabel in favoriteLabelList) { _session.Delete(favoriteLabel); } // 删除收藏 _session.Delete(favorite); } }
标签:response lis guid null each info ring 收藏 ssi
原文地址:http://www.cnblogs.com/xdot/p/6424121.html