Skip to content

Multiple column Select doesn't respect ODataPropertyName attribute #131

@onthepenciltip

Description

@onthepenciltip

Having some class,

public class Thing
{
    [ODataPropertyName("title")]
    public string Title { get; set; }

    [ODataPropertyName("id")]
    public string Id { get; set; }
}

the next code doesn't work as expected:

var query = new ODataQueryBuilder()
    .For<Thing>("Things")
    .ByList()
    // expected: title,id
    // actual: Title,Id
    .Select(x => new { x.Title, x.Id });
    // allow multiple select as a solution?
    //.Select(x => x.Title)
    //.Select(x => x.Id)
    // or introduce another approach for selecting several columns?

var parts = query.ToDictionary();

We get value Title,Id for $select but expecting title,id.

The documentation talks about using .Select(s => new { s.Id, s.Sum, s.Type }).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions