I was wondering why Entity Framework in my code was so "chatty" with the DB. after searching in Microsoft documentation, I found that normally, when using "T DbSet.Find(params object keys)", it should first check in the ObjectStateManager to see if the entity hasn't been loaded yet into memory, if yes it should return this in-memory entity, if not then fetch it from the store. (ref to the article : Caching in the Entity Framework

however, after doing some really basic testing in a console app, I can't get to this behaviour.
In that console app (C#10, .NET Core 6, EF6), I already have the table with a primary key on SQL server 2022. So I just created a Class Inheriting from DbContext and added a DbSet of a class manually created which look like that :
TestContext.cs
public class TestContext : DbContext
{
public TestContext(string nameOrConnectionString)
: base(nameOrConnectionString)
{
}
public DbSet<TestRq> TestRq { get; set; }
}
TestRq.cs
[Table("TestRq",Schema = "Test")]
public class TestRq
{
[Key]
public decimal RQ {get; set;}
public string RQ_VALUE {get; set;}
public decimal RT {get; set;}
public string RT_SHORT_DESC {get; set;}
}
then in my program.cs
I'm just doing this
using var testContext = new TestContext("Test");
var testRqFind = testContext.TestRq.Find(3);
Thread.Sleep(5000);
testRqFind = testContext.TestRq.Find(3);
from a connection string point of view, as I'm not using any "real" Code-First/Database-First approach, I have a "basic" sqlClient connection string :
<add name="Test" connectionString="Data source=MySqlServer\SQL22;Database=TestRqDB;User=myUser;Password=myPassword" providerName="System.Data.SqlClient" />
looking at SQL Profiler, we can clearly see that the DbContext execute 2 time the same query.

I did some debugging and the ObjectStateManager does contain the entity in his memory between the 2 find execution. so I have no clue what am I doing wrong here.
any hint on why the find does not take the in-memory entity the second time ?