Properties discovered by HasKey or similar are not discovered as primitive collections
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
For example, assuming `CollectionCompanyId` and `CollectionTenantId are not discovered as properties by convention (for example, they are fields), then:
```C#
modelBuilder.Entity(
b =>
{
b.HasKey(e => new { e.CollectionCompanyId, e.CollectionTenantId });
});
```
Will add the properties to the model, but as non-collection primitive properties. The workaround is to explicit map the primitive collections first:
```C#
modelBuilder.Entity(
b =>
{
b.PrimitiveCollection(e => e.CollectionCompanyId);
b.PrimitiveCollection(e => e.CollectionTenantId);
b.HasKey(e => new { e.CollectionCompanyId, e.CollectionTenantId });
});
```
Contributor guide
Assessment
This issue has not been assessed yet.