title: Unexpected operations inside the classes of Migration folder in C#
body: <p>After writing the initial model, I added the migration by using command Add-Migration from the console. The three migration files were created but I had some unexpected and undefined operations in the files.</p>
  
  <p>Student Class:</p>
  
  <pre><code>public class Student
  
  {
      public string StudentsUserId { get; set; }
      public bool is_accepted { get; set; }
      public int Number_preferences { get; set; }
  
      public List&lt;Preference&gt; Preferences { get; set; }
      public List&lt;Offers&gt; Offers { get; set; }
      public List List { get; set; }
      [NotMapped]
      public IList&lt;Courscategory&gt; courshistory { get; set; }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>OffersClass:</p>
  
  <pre><code>   public class Offers
      {
          public string CourseID { get; set; }
  
          public string SupervisorUserId { get; set; }
          public string Department { get; set; }
          public string Email { get; set; }
          public int Max_student { get; set; }
          public string CourseName { get; set; }
          public string CourseDescription { get; set; }
          public DateTime Start { get; set; }
          public DateTime End { get; set; }
          public int CourseAvaialbility { get; set; }
          public string Requirements { get; set; }
          public bool IsFull { get; set; }
  
  
          public Supervisors Supervisor { get; set; }  //Supervisor is a separate class
          public List&lt;CList&gt; List { get; set; }
  
      }
  }
  </code></pre>
  
  <p>List Class:</p>
  
  <pre><code>   public class List
      {
          public string CourseID { get; set; }
          public string CourseName { get; set; }
          public string StudentsUserId { get; set; }
          public string SupervisorUserId { get; set; }
          public DateTime StartDate { get; set; }
          public DateTime EndDate { get; set; }
  
          public Offers Offer { get; set; }
          public List&lt;Students&gt; Studnets { get; set; }
          public List&lt;Supervisors&gt; Supervisor { get; set; }
  
          public List&lt;Preference&gt; Preference { get; set; }
  
      }
  }
  </code></pre>
  
  <p>Code in Migration File:</p>
  
  <pre><code>migrationBuilder.CreateTable(
              name: "CStudents",
              columns: table =&gt; new
              {
                  StudentsUserId= table.Column&lt;string&gt;(nullable: false),
                  is_accepted = table.Column&lt;bool&gt;(nullable: false),
                  Number_preferences = table.Column&lt;int&gt;(nullable: false),
                  ListCourseID = table.Column&lt;string&gt;(nullable: true)
              },
              constraints: table =&gt;
              {
                  table.PrimaryKey("PK_CStudents", x =&gt; x.StudentsUserId);
                  table.ForeignKey(
                      name: "FK_StudentsUserId_List_ListCourseID",
                      column: x =&gt; x.ListCourseID,
                      principalTable: "List",
                      principalColumn: "CourseID",
                      onDelete: ReferentialAction.Restrict);
              });
  </code></pre>
  
  <p>Initial model code:</p>
  
  <pre><code>public class CFE_CrazyLabContext : DbContext
  {
      public CFE_CrazyLabContext(DbContextOptions&lt;CFE_CrazyLabContext&gt; options)
          : base(options)
      {
      }
  
      public DbSet&lt;LearnAngebot.Models.CStudents&gt; Students{ get; set; }      
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
  
          modelBuilder.Entity&lt;CStudents&gt;().HasKey(o =&gt; o.StudentsUserId);
  
      }
  }
  </code></pre>
  
  <p>The ListCourseId does not exist in the Student class not is it a variable of that class. No idea how these operations got added.</p>