Database model scaffolding with composite primary keys

Hello Radzen team,

I´m trying to implement a many-to-many relationship using a junction table on a MSSQL data-source. The junction table only stores the primary keys (guids as uniqueidentifier) of the related tables and uses both as a composite primary key. Interfering the database schema works as expected, except the model of the junction table. Only one property has the key annotation, which leads to problems with the entity framework when inserting or updating multiple records. (The entity framework can not track changes for multiple records with the same primary key)

First entity:

public partial class ServicePlan
    {
      [Key]
      public Guid Id { get; set;}
      public string Name { get; set; }
      ...
      public ICollection<ServicePlansServiceLevelAgreement> ServicePlansServiceLevelAgreements { get; set; }
    }

Second entity:

public partial class ServiceLevelAgreement
    {
      [Key]
      public Guid Id { get; set;}
      public string Name { get; set; }
      ...
      public ICollection<ServicePlansServiceLevelAgreement> ServicePlansServiceLevelAgreements { get; set; }
    }

The scaffolded junction table:

public partial class ServicePlansServiceLevelAgreement
    {
      [Key]
      public Guid ServicePlanId { get; set;}
      public Guid ServiceLevelAgreementId { get; set;}
      public ServicePlan ServicePlan { get; set; }
      public ServiceLevelAgreement ServiceLevelAgreement { get; set; }
    }

The database context:

...
builder.Entity<ServiceTask.Models.Database.ServicePlansServiceLevelAgreement>().HasKey(table => new {
              table.ServicePlanId, table.ServiceLevelAgreementId
            });
...

The scaffolded model of the junction table is missing the second key annotation, so it should look like this:

public partial class ServicePlansServiceLevelAgreement
    {
      [Key]
      public Guid ServicePlanId { get; set;}
      [Key]
      public Guid ServiceLevelAgreementId { get; set;}
      public ServicePlan ServicePlan { get; set; }
      public ServiceLevelAgreement ServiceLevelAgreement { get; set; }
    }

I tried to manually insert the key annotation and ignore the file from radzen generation, which resolved the mentioned problems with entity framework.
This issue occurred so far only when using a composite primary key.

Thanks for the report @philfoso! We will fix this in the next version!