It looks like OwnedNavigationBuilder.HasIndex is returning the wrong type. I believe it should return IndexBuilder<TDependentEntity>. In the code sample below, I cannot IncludeProperties from the type since it is showing the parent type's properties.
|
public virtual IndexBuilder<TEntity> HasIndex([NotNull] Expression<Func<TDependentEntity, object>> indexExpression) |
Include your code
public sealed class Blog {
public int BlogId { get; set; }
public string Name { get; set; } = default!;
public ICollection<Post> Posts { get; set; } = new HashSet<Post>();
public sealed class Post {
public int BlogId { get; set; }
public int PostId { get; set; }
public string Name { get; set; } = default!;
public DateTime PostedDate { get; set; }
}
internal class EntityConfiguration : IEntityTypeConfiguration<Blog> {
public void Configure(EntityTypeBuilder<Blog> entity) {
entity.ToTable(nameof(Blog));
entity.HasKey(x => x.BlogId).IsClustered();
entity.OwnsMany(x => x.Posts, post => {
post.ToTable(nameof(Post));
post.HasKey(x => x.PostId).IsClustered();
post.HasIndex(x => x.BlogId).IncludeProperties(x => x.PostedDate); // This line has build errors
});
}
}
}

Include provider and version information
EF Core version: 5.0.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.8.4
It looks like
OwnedNavigationBuilder.HasIndexis returning the wrong type. I believe it should returnIndexBuilder<TDependentEntity>. In the code sample below, I cannotIncludePropertiesfrom the type since it is showing the parent type's properties.efcore/src/EFCore/Metadata/Builders/OwnedNavigationBuilder`.cs
Line 182 in 2738442
Include your code
Include provider and version information
EF Core version: 5.0.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.8.4