Entity framework saving context

南笙酒味 提交于 2019-12-11 07:39:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!