I have this in my Article class:
public int GalleryID { get; set; }
public virtual Gallery Gallery { get; set; }
and this is my gallery class:
public class Gallery
{
public int GalleryId { get; set; }
public string Name { get; set; }
public virtual ICollection<Photo> Photos { get; set; }
}
when I delete gallery by this in repository:
public virtual void Delete(int id)
{
T entity = dbset.Find(id);
dbset.Remove(entity);
dataContext.SaveChanges();
}
I deleted article too but that isn´t what I want. I want to keep article (just maybe set galleryId to 0 a and gallery to null. Thanks