There are 2 tables:
public class Station : IEntitie { [Key] public int Id { get; set; } public string Description { get; set; } } public class OperativeSchedule : IEntitie { [Key] public int Id { get; set; } public virtual Station DispatchStation { get; set; } //для таблицы station надо задать ключ public virtual Station StationOfDestination { get; set; } //для таблицы station надо задать ключ } It is necessary to set the key in the Station table to communicate with OperativeSchedule . Now when deleting a Station from Stations an exception is thrown if DispatchStation or StationOfDestination refers to this station.