title: Creating record for entity framework with relationships to other records : ASP.NET Core 6 Minimal API (SQL / Postgres)
body: <p>I have two tables, <code>Participant</code> and <code>Meeting</code>, in an ASP.NET Core 6 minimal API project set up like this:</p>
  <pre><code>record Participant(int id)
  {
      public string name { get; set; } = default!;
      public string title { get; set; } = default!;
  }
  
  record Meeting(int id)
  {
      public string subject { get; set; } = default!;
      public string organizer { get; set; } = default!;
      public DateTime starttime { get; set; } = default!;
      public DateTime endtime { get; set; } = default!;
  }
  
  class MyDb: DbContext 
  {
      public MyDb(DbContextOptions&lt;MyDb&gt; options): base(options) 
      {
      }
  
      public DbSet&lt;Participant&gt; Participants =&gt; Set&lt;Participant&gt;();
  
      public DbSet&lt;Meeting&gt; Meetings =&gt; Set&lt;Meeting&gt;();
  }
  </code></pre>
  <p>Now I need to create a combining table / record which connects these two tables / records</p>
  <p>In SQL this would be this table</p>
  <pre><code>CREATE TABLE meetings_participants
  (
      meeting_id int NOT NULL,
      participant_id int NOT NULL,
      PRIMARY KEY (meeting_id, participant_id),
      CONSTRAINT fk_meeting_id 
          FOREIGN KEY (meeting_id) REFERENCES meetings(id),
      CONSTRAINT fk_participant_id 
          FOREIGN KEY (participant_id) REFERENCES participants(id)
  );
  </code></pre>
  <p>But how do I write it in EF as a record with foreign keys ?</p>