Code First will often interpret unidirectional relationships as one to many. Because of this, you must utilize Fluent API to inform Code First that you want a many-to-many self-referencing association:...protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<Member>().HasMany(m => m.Friends).WithMany().Map(m =>...
You may just dial:...var tmp = from x in db.Mailings
select new MailingViewModel
FirstName = x.FirstName,
LastName = x.LastName,
Address = x.Address
...If you access EF directly in the controller, AutoMapper is not necessary for basic projection....AutoMapper canno...
I think I have it figured out now....The answer is to change the PersonController Delete() stub as follows:...using (var context = new DataContext())
Person person= context.Persons.Find(id);
foreach (var child in person.Children.ToList())