How can I save a list of enitty into the database using Entity Framework Code First?
I have problem saving the list of entity.
Below is the code I have written:
List<Account> accounts = ActivateAccount();
// Save merchant account & bank information into database
using (var context = new MyContext())
{
try
{
context.Accounts.Attach(accounts);
context.SaveChanges();
}
catch (Exception ex)
{
}
}
Thank you.