Home > OS >  Does ExecuteSqlRaw() require SaveChanges()?
Does ExecuteSqlRaw() require SaveChanges()?

Time:03-06

If I execute some SQL:

await DbContext.Database.ExecuteSqlRawAsync();

Does that then need a call to:

await DbContext.SaveChangesAsync();

Does anyone know if this is clearly documented somewhere? I'm having difficulty finding it.

CodePudding user response:

They are unrelated. Raw SQL Queries can change the database directly. Modified entities in the change tracker change the database on SaveChanges.

  • Related