How to update FK to null when deleting optional related entity
I'm reasonably new to EF, and struggling a little to facilitate deleting my objects. My two objects and associated DbContext look as follows: public class Context: DbContext { public Context() : base(){} public DbSet<Person> Persons {get;set;} public DbSet<Vehicle> Vehicles {get;set;} } public class Person { public int PersonID {get;set;} public string Name {get;set;} } public class Vehicle { public int VehicleID {get;set;} public int? PersonID {get;set;} [ForeignKey("PersonID")] public virtual Person Person {get;set;} } As per above, one person can be linked to multiple vehicles. There is no