title: How to fix 'Unable to determine the relationship represented by navigation X' of type X error in Entity Framework Core
body: <p>I'm working on an ASP.NET Core 5 project using Entity Framework Core.</p>
  <p>I have these entities</p>
  <pre><code>public class StudentTrainingMark
  {
          public         int           Id              { get; set; }
          public         decimal       TheoreticalMark { get; set; }
          public         decimal       PracticalMark   { get; set; }
          public         string        Note            { get; set; }
  
          public         string        BranchId        { get; set; }
          public         byte          FormationYearId { get; set; } 
          public         string        StudentId       { get; set; }
  
          public virtual Branch        Branch          { get; set; }
          public virtual FormationYear FormationYear   { get; set; }
          public virtual Student       Student         { get; set; }
  }
  
  public class Student
  { 
      public string Id         { get; set; }
      public string FirstName  { get; set; }
      public string FamilyName { get; set; }
  
      public virtual ICollection&lt;StudentTrainingMark&gt;   StudentTrainingMarks { get; set; }
  }
  </code></pre>
  <p>I created configuration profile for each entity to do some configs like required fields and relationships.</p>
  <p>So <code>StudentTrainingMark</code> also has a config profile like this:</p>
  <pre><code>public class StudentTrainingMarkEntityConfig:IEntityTypeConfiguration&lt;StudentTrainingMark&gt;
  {
      public void Configure( EntityTypeBuilder&lt;StudentTrainingMark&gt; builder )
      {
          builder.HasKey( x =&gt; x.Id );
          builder.Property( x =&gt; x.Id ).UseIdentityColumn();
  
          builder.Property( x =&gt; x.TheoreticalMark ).IsRequired();
          builder.Property( x =&gt; x.PracticalMark ).IsRequired();
  
          builder.Property( x =&gt; x.BranchId ).IsRequired();
          builder.Property( x =&gt; x.FormationYearId ).IsRequired();
          builder.Property( x =&gt; x.StudentId ).IsRequired();
      }
  }
  </code></pre>
  <p>And <code>Student</code> also has a config profile like this:</p>
  <pre><code>public class StudentEntityConfig:IEntityTypeConfiguration&lt;Student&gt;
  {
      public void Configure( EntityTypeBuilder&lt;Student&gt; builder )
      {
          builder.HasKey( x =&gt; x.Id );
          builder.Property( x =&gt; x.Id ).IsRequired();
  
          builder.Property( x =&gt; x.FirstName ).IsRequired();
          builder.Property( x =&gt; x.FamilyName ).IsRequired();
          builder.Property( x =&gt; x.BirthDate ).IsRequired();
          builder.Property( x =&gt; x.BirthPlace ).IsRequired();
          builder.Property( x =&gt; x.Gender ).IsRequired();
          builder.Property( x =&gt; x.Nationality ).IsRequired();
          builder.Property( x =&gt; x.Address ).IsRequired();
          builder.Property( x =&gt; x.DateOfRegistration ).IsRequired();
          builder.Property( x =&gt; x.AcademicYearOfRegistration ).IsRequired();
          builder.Property( x =&gt; x.StudentGuardianId ).IsRequired( false );
  
          builder.Property( x =&gt; x.StudyLevelId ).IsRequired();
          builder.Property( x =&gt; x.GroupId ).IsRequired();
      }
  }
  </code></pre>
  <p>What is exactly the issue?</p>
  <p>The issue is with all of this when I try to add new migration I get this error</p>
  <blockquote>
  <p>Unable to determine the relationship represented by navigation 'Student.TrainingMark' of type 'StudentTrainingMark'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.</p>
  </blockquote>
  <p>Please - any help on how to fix this issue?</p>