I have these three entities:
public class Dog
{
public int DogId { get; set; }
public string Name { get; set; }
public int Age { get; set; }
publ
I've only done this using the fluent method (when I was learning I found you can do everything in fluent, but not with annotations, so I've not looked into them), the following creates a many to many between my Unit
entity and my UnitService
entity:
modelBuilder.Entity()
.HasMany(u => u.Services)
.WithMany(us => us.Units);
This code is in the protected override void OnModelCreating(DbModelBuilder modelBuilder)
method.
In your case Event
is Unit
and Dog
is UnitService
.
Oh ooops, you don't need that at all, your 'join' table is your results table, in my case I don't care about the join table so its all hidden. Maybe something like:
modelBuilder.Entity()
.HasMany(e => e.Results);
modelBuilder.Entity()
.HasMany(d => d.Results);