'EF Core 5 Many-to-Many relation - Change the Navigation key

I have two entities with many to many relationships in EF Core 5 and I am using fluent API to set the relationship.

public class Framework
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public long Id { get; set; }

    [Required]
    public string Name { get; set; }

    public IList<Path> Paths { get; set; } = new List<Path>();
}

public class Path
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public long Id { get; set; }

    [Required]
    public string Name { get; set; }

    public IList<Framework> Frameworks { get; set; } = new List<Framework>();
}

protected override void OnModelCreating(ModelBuilder builder)
{
      base.OnModelCreating(builder);

      builder.Entity<Framework>()
          .HasMany(x => x.Paths)
          .WithMany(x => x.Frameworks)
          .UsingEntity<Dictionary<string, object>>(
              "FrameworkPaths",
              x => x.HasOne<Path>().WithMany(),
              x => x.HasOne<Framework>().WithMany(),
          );

It is working fine and data is being added in the many to many table (which has these columns FrameworksId, PathsId)

But now I want to change the Property name in Path entity from Frameworks to LinkedFrameworks as

public IList<Framework> LinkedFrameworks { get; set; } = new List<Framework>();

How can I use this new property name LinkedFrameworks instead of Framework in CRUD operations of entites?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source