I am new to using .NET Core and EF Core.
I have one sentence inside a table of my database and I have to execute like (using ADO.NET):
using (var command = context.Database.GetDbConnection().CreateCommand())
{
command.CommandText = "<<my sql sentence>>";
context.Database.OpenConnection();
using (var result = command.ExecuteReader())
{
....
}
}
I found this documentation.
Is it necessary to close the connection after I execute the query? I suppose I should do it (I think), but I don't know if it is necessary, or if it will close automatically.