Skip to content

Instantly share code, notes, and snippets.

@ianChen806
Created August 18, 2022 02:48
Show Gist options
  • Save ianChen806/9c8413a00e507566f8ebace49ff6aae8 to your computer and use it in GitHub Desktop.
Save ianChen806/9c8413a00e507566f8ebace49ff6aae8 to your computer and use it in GitHub Desktop.
ef update without select
// ef
[Fact]
public async Task Test()
{
var agent = new Agent()
{
Id = 9,
Name = "new2"
};
_db.Agents.Attach(agent);
_db.Entry(agent).Property(r => r.Name).IsModified = true;
_db.SaveChanges();
}
// ef core
[Fact]
public async Task Test()
{
var agent = new Agent()
{
Id = 9,
Name = "new2"
};
_db.Entry(agent).Property(r => r.Name).IsModified = true;
_db.SaveChanges();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment