を追跡されていません。Entity Frameworkのアップデート - コンテキストは、現在私は、エンティティを更新しようとしていますが、私は次のエラーを取得していますエンティティ
The context is not currently tracking the entity.
私のDBテーブルには、次のフィールドから構成されています
fixturedate, leagueID (FK), Team A (FK), Team B (FK).
次のように私のコードは次のとおりです。
public void UpdateFixture(Fixture validFixture)
{
Fixture fixture = new Fixture();
fixture = entities.Fixtures.Where(f => f.fixtureId == validFixture.fixtureId).FirstOrDefault();
League league = new League();
league.LeagueId = validFixture.leagueId;
fixture.League = leagueActions.GetLeague(league);
fixture.Team1 = teamActions.GetTeam(validFixture.teamA);
fixture.Team2 = teamActions.GetTeam(validFixture.teamB);
entities.UpdateObject(validFixture);
entities.SaveChanges();
}
私はentities.AttachTo("Fixtures", validFixture);
を行うと、私はfolloを取得ウィングエラー:
The context is already tracking a different entity with the same resource Uri.
フィクスチャエンティティの更新には何が必要ですか?
こんにちはカルコ、そうです。実際のフィクスチャーを更新しなければならなかった!どうもありがとう – Johann