Skip to content

AutoMapper/AutoQueryable/EntityFramework select filtering #80

@tomkurian01

Description

@tomkurian01

Currently I have something that looks like this in my Get Controller API. (I'm using Entity Framework 6, Automapper 7)

_ctx.Person.UseAsDataSource(mapper).For();

But what happens in the database is that it does a select on each column in the table even if only ask for a couple of items from the URI. I was wondering if there is an optimal way to do this so that only the items that are selected in the URI are selected on in the table:

So for example if I did a URI like this: http//localhost/api/v1/person?select=id,firstname

I would get a query like select [Extent1].id, [Extent1].firstname from Person as [Extent1]

Currently the query looks like this:
select [Extent1].id, [Extent1].firstname, [Extent1].lastname, [Extent1].middlename, etc. from
Person as [Extent1]

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