问题
public static TraffickingToScheduled CreateTraffickingToScheduled(int ScheduledID, global::System.DateTime startDate, global::System.DateTime endDate, int originatingNetworkID, int showID, int seasonID, int episodeID, string ffDisable)
{
TraffickingToScheduled traffickingToScheduled = new TraffickingToScheduled();
traffickingToScheduled.ScheduledID = ScheduledID;
traffickingToScheduled.StartDate = startDate;
traffickingToScheduled.EndDate = endDate;
traffickingToScheduled.OriginatingNetworkID = originatingNetworkID;
traffickingToScheduled.ShowID = showID;
traffickingToScheduled.SeasonID = seasonID;
traffickingToScheduled.EpisodeID = episodeID;
traffickingToScheduled.FFDisable = ffDisable;
return traffickingToScheduled;
}
Context.AddToTraffickingToScheduleds(traffickingToScheduled);
Save();
I have a foreign reference with Scheduled table to TraffickingToScheduled table with 1 to 1 relationship. while saving it throws the error as TraffickingToScheduled participate in TraffickingToScheduled_FK_Scheduled relationship. 0 related "Scheduled" is found.1 Scheduled is expected.
来源:https://stackoverflow.com/questions/12387771/entity-framework-saving-context