title: How to represent aggregate entities using Code-First?
body: <p>I have recently started developing using ASP.NET and am struggling to grasp Code-First. I am working on a project for an internship and have very little database knowledge except for one class I've taken. I am in no way asking for a complete solution or being lazy.</p>
  
  <p>I've been trying for a couple days to create a solid ER diagram and I'm fairly certain the one below will represent all of the information I need to store. Please let me know if you see any ways this can be improved.</p>
  
  <p><b>What I'm trying to do:</b></p>
  
  <p>For this project an administrator will create rooms with attributes listed below. The admin will then assign time-slots that represent between what hours the room will be available and what days of the week it will be available.</p>
  
  <p>The users will fill out their basic information and fill out a form representing what times they are available.</p>
  
  <p>After all the users have registered the admin will run a scheduling algorithm to come up with the closest to a most efficient schedule that it can (because it's NP hard).</p>
  
  <p>The assigned relation represents user time slots that are related to room time slots in order to produce a table of what users are assigned to what rooms at what times.</p>
  
  <p>I'm using Visual Studio 2012.</p>
  
  <p><b>Questions</b></p>
  
  <ol>
  <li>How would I represent these aggregate entities using Code-First? Not necessarily asking for the code for this exact diagram but maybe quick example to help me wrap my head around Code-First.</li>
  <li>Do my mappings look correct for these relations?</li>
  </ol>
  
  <p>Any help or point in the right direction is greatly appreciated!! Thank you!</p>
  
  <p>Below is an ER diagram that represents the following:</p>
  
  <ul>
  <li>Room (id, number, building, capacity)</li>
  <li>TimeSlot (id, startHour, endHour, dayOfWeek)</li>
  <li>User (id, firstName, lastName, email)</li>
  <li>Available (userId, timeID)</li>
  <li>Reserved (roomID, timeID)</li>
  <li>Assigned (reservedID, availableID)</li>
  </ul>
  
  <p><img src="https://i.imgur.com/DB5USEx.png" alt="ER Diagram"></p>