No changes are made to the database.

オープン 初心者向け
#5,536 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
67/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp
領域
documentation

調査の方向性

報告された動作は、entity-framework/core/logging-events-diagnostics/events.md にあるイベントの記事に関するものです。まず、変更追跡についての説明と提示された例を読み、イベントの実行前に変更がいつ検出されるかを説明しているか確認してください。記事に、DetectChanges() が報告された Modified タイムスタンプに影響する理由を示す簡単な例または補足説明が含まれれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Type of issue

Code doesn't work

Description

When the Blog.Name property changes, the entity changes, and that is, after the code runs in the database, the Modified field in the Blog table should contain a timestamp. But after running the code, the Modified field in table Blogs remains NULL.

I achieved the desired result by adding DetectChanges().

    using (var context = new ApplicationDbContextFactory().CreateDbContext(null))
    {
        var blog = await context.Blogs.Include(e => e.Posts).SingleAsync();

        blog.Name = "EF Core Blog";
        context.Remove(blog.Posts.First());
        blog.Posts.Add(new Post { Id = 3, Title = "EF Core 6.0!" });

        context.ChangeTracker.DetectChanges(); //  added !!!
        //Console.WriteLine(context.ChangeTracker.DebugView.LongView);
        await context.SaveChangesAsync();
    }

This is most likely due to the fact that when an event occurs, actions are performed that have yet to be detected.
I think you can come up with a simple example for this topic.

Page URL

https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/events

Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/logging-events-diagnostics/events.md

Document Version Independent Id

89098121-5603-26ba-da4d-331aea51f237

Platform Id

18721c6e-6ce4-b9d5-d5d3-1dfb758158b1

Article author

@SamMonoRT

主要言語
Mermaid
スター
1.7k
フォーク
2k
平均マージ
1日 5時間
マージ済み PR(30日)
33

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/EntityFramework.Docs のほかの issue

dotnet/EntityFramework.Docs の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。