Ok, so i have this problem right now. I have 2 Models like so:
public class Contact: BaseModel
{
public string LastName { get; set; }
public string FirstMidName { get; set; }
public string Adress { get; set; }
public int UserID { get; set; }
[Display(Name = "Full Name")]
public string FullName
{
get
{
return FirstMidName+ " " + LastName;
}
}
public virtual List<Group> Groups { get; set; }
public virtual User User { get; set; }
public virtual ICollection<Phones> Phones { get; set; }
}
and also:
public class Group:BaseModel
{
public string Name { get; set; }
public int UserID { get; set; }
public virtual User User { get; set; }
public virtual List<Contact> Contacts { get; set; }
}
the idea is that many contacts can be in many groups. But here comes my problem. I remove the convention ondeleteCascade with many to many because i had to otherwise my code wouldnt work.But... how can i delete only one contact... without it cascading and deleting all the groups its in and all the contacts that group contains and so on and so forth. Thats my problem id love to be able to delete one contact not a group tho. i do not want the group to be deleted just the contact. Please help