private static void SeedPersonData(ApplicationDbContext ctx) { var superUser = ctx.Users.Single(u => u.UserName.Equals("*****@*****.**")); var superUserId = superUser.Id; string[] names = new[] { "Tristan Krass", "Morris Mason", "Rose Mason", "Madeleine Mason", "Sophie Mason", "Charlotte Mason", "Isabelle Mason" }; string[] familyNames = new[] { "Krass", "Mason", "Rose" }; string[] relationShipTypes = new[] { "Mom-Son", "Dad-Son", "Brother-Brother", "Brother-Sister", "Married" }; string[] relationShipRoles = new[] { "Mom", "Son", "Brother", "Sister", "Dad", "Wife", "Husband" }; DateTime[] dateTimes = new[] { new DateTime(1998, 6, 20), new DateTime(1950, 1, 12), new DateTime(1975, 3, 5), new DateTime(2004, 2, 15), new DateTime(1980, 12, 12), new DateTime(1970, 4, 20), new DateTime(1975, 12, 31), }; ; foreach (var familyName in familyNames) { var family = new Family() { FamilyName = familyName }; MetaData.AddInitialClassMetaDataSeeding(family, superUserId); ctx.Families.Add(family); ctx.SaveChanges(); } int i = 0; foreach (var name in names) { var person = new Person() { FirstName = name.Split()[0], LastName = name.Split()[1], DateOfBirth = dateTimes[i], AppUserId = superUserId, Sex = i % 2 == 0 ? Sex.FEMALE : Sex.MALE }; MetaData.AddInitialClassMetaDataSeeding(person, superUserId); ctx.Persons.Add(person); i++; ctx.SaveChanges(); } foreach (var role in relationShipRoles) { var rL = new RelationshipRole() { RelationshipRoleName = role }; MetaData.AddInitialClassMetaDataSeeding(rL, superUserId); ctx.RelationshipRoles.Add(rL); } ctx.SaveChanges(); foreach (var relationShipType in relationShipTypes) { var relationshipType = new RelationshipType() { RelationshipTypeName = relationShipType }; MetaData.AddInitialClassMetaDataSeeding(relationshipType, superUserId); } ctx.SaveChanges(); }