Skip to content

Capabilities vocabulary ignored when using composite key #38

@rpallares

Description

@rpallares

[Capabilities vocabulary support(https://learn.microsoft.com/en-us/odata/webapi/capabilities-vocabulary-support) is working well for an entity until we use Key value binding

Assemblies affected

  • OData ModelBuilder 1.0.9

Reproduce steps

public class MyEntity
{
    public Guid Id { get; set; }
    
    [Required]
    [NotSortable]
    [NotFilterable]
    public required string SomeStringKey { get; set; }
}


private IEdmModel BuildModel()
{
    var builder = new ODataConventionModelBuilder();
    var entitySetConfiguration = builder.EntitySet<MyEntity>(nameof(MyEntity));
    
    // If this line is present FilterRestrictions and SortRestrictions are removed from metadata.xml
    entitySetConfiguration.EntityType.HasKey(e => new { e.SomeStringKey, e.Id });
    
    return builder.GetEdmModel();
}

Expected result

Capabilities annotations should be declared whatever the entity key definition

Actual result

Capabilities annotations are ignored if the entity declare a composite

Additional detail

This may be related to #10, but I'm not sure if #10 is just obsolete or not

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions