The relationships in my case Photo -PhotoId PhotoGroupsMap - MapingId(PK), PhotoId(FK with Photo) PhotoShare - ShareId(PK),PhotoId(FK with Photo) PhotoGroupComment - MapingId (FK with PhotoGroupsMap)
And i am using LinqSql for deletion and i want to Delete a Photo Object and i used the code
Photoset _item = (from item in dbContext.Photos
where ....
select item).SingleOrDefault();
//remove all Photo Share Entries
dbContext.PhotosetShareMaps.DeleteAllOnSubmit(_item.PhotoShareMaps);
//remove all Photo Group entries
dbContext.PhotoGroups.DeleteAllOnSubmit(_item.PhotoGroups);
But how can i delete all Comments Associated with Groups? Since in this case if am trying to Delet Some Photo which is in some groups and the group contains some comment row , i am getting error (Since i am not removeing comments ). How can i remove that ?
尝试级联删除“注释”,同时删除“组”。要获取有关级联删除的更多信息,请参考此链接
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.