0
TimMackey created
In the section "Database Migrations", when creating file InitialPeopleCreator.cs the code is
namespace Acme.PhoneBookDemo.Migrations.Seed.Host
{
public class InitialPeopleCreator
{
private readonly PhoneBookDemoDbContext _context;
public InitialPeopleCreator(PhoneBookDemoDbContext context)
{
_context = context;
}
public void Create()
{
var douglas = _context.Persons.FirstOrDefault(p => p.EmailAddress == "[email protected]");
if (douglas == null)
{
...
}
}
}
}
Later in the "Adding Database Migration" section the file 'InitialPeopleCreator.cs' is renamed 'InitialPeopleAndPhoneCreator.cs'. The code
var douglas = _context.Persons.FirstOrDefault(p => p.EmailAddress == "[email protected]");
introduces an error which is causing duplicate records for douglas.adams to be added to the database.
"[email protected]"
should be
"[email protected]")