Can explain somebody what is the main differences between SaveChanges and SaveChangesAsync ? Where I should use SaveChangesAsync and when ?
How's the performance varies ?
I have two examples here :
Asyncronous function:
private static async void AddStudent()
{
Student myStudent = new Student();
using (var context = new SchoolDBEntities())
{
context.Students.Add(myStudent);
await context.SaveChangesAsync();
}
}
Syncronous function:
private static void AddStudent()
{
Student myStudent = new Student();
using (var context = new SchoolDBEntities())
{
context.Students.Add(myStudent);
context.SaveChanges();
}
}
Thanks in advance !.