实体框架保存上下文

时间:2012-09-12 12:03:01

标签: entity-framework save

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();

我有Scheduled表到TraffickingToScheduled表的外来引用,具有1比1的关系。保存它会导致错误TraffickingToScheduled参与TraffickingToScheduled_FK_Scheduled关系。找到0个相关的“预定”。Scheduled是预期的。

0 个答案:

没有答案