Hi all,
I'm new to NHibernate and having problems deleting a row from the repository. I keep getting the error:
could not delete collection rows: [BOD.Entities.Hierarchy.Tag.TagImages#b051c925-c09f-46fb-a1e1-0079686e8b4c][SQL: UPDATE [TagImage] SET Tag_id = null WHERE Tag_id = @p0 AND tag_image_id = @p1]
Here is my Code:
ITagRepository<BOD.Entities.Hierarchy.Tag> tagRep = MyRepository<BOD.Entities.Hierarchy.Tag>(); BOD.Entities.Hierarchy.Tag tag = tagRep.Get(image.TagId);
tag.TagImages.Remove(image); tagRep.DbContext.CommitChanges();
I have also tried using SaveOrUpdate() before the commitchanges() but that still throws an error. Does anyone have any ideas or a general direction I should be looking? I have also tried just using SaveOrUpdate() with commit changes, this proceeeds but deletes nothing. thanks!
|