I want to understand how EF track ID when the primary key is identity. (DB first)For exampleclass User{    int Id; //auto generated via SQL identity, also the primary key of the table Users.    string Name;}//adding a new user-User user = new User () {Name=TestUser};//Id will be 0;DB.Users.Add(user);DB.SaveChanges();user.Id; //Will have value;More over if I have navigation property with foreign key to the user.Id will be updated as well.I believe that EF track tables with the primary key, but in this case it is determined by SQL (or w/e) on creation, so how does the EF gets the actual ID after creation?
How does Entity Framework track object with identity as key
c#;database;entity framework;identity