There is a composite key in your trigger class (TriggerId, TaskId). But your TriggerHistory has a Trigger navigation property with ForeignKey defined using only the TaskId property.
Try changing the ForeignKey property to Triggers properties as follows:
[ForeignKey("TriggerId,TaskId")] public virtual Trigger Triggers { get; set; }
And perhaps the Triggers property should be called "Trigger" because it is not a collection of Trigger objects.
source share