I am making sure to fully understand this following code:
static void Main(string[] args)
{
var person = new Person {FirstName = "Nadege",
LastName = "Deroussen", BirthDate = DateTime.Now};
using (var context = new MyContext())
{
context.Persons.Add(person);
context.SaveChanges();
}
Console.Write("Person saved !");
Console.ReadLine();
}
As you can see, using is follow by {}, Correct me if I am wrong, does it means the the context would be closed after the {} ? a DBContext should it be closed everytime such as this ?
Cheers all