Skip to content

Ignore specific property in a query #20747

Closed as duplicate
Closed as duplicate

Description

@steven62f

I have an entity with a byte[] property to store photo. This entity is referenced by many others entities. When I request these other entities, I often have to include the entity that contains the photo, but in the end, I don't care about this photo. It is only used in very specific cases.

On one of my requests, I recover more than 4 MB of data. I added the "NoMapped" attribute on the photo property and the data volume went down to 200 KB. Unfortunately, the "NotMapped" attribute is not suitable. In some cases, I have to recover the photo data.

It would be very useful, during a request, to be able to ignore the retrieval of specific properties.

Ex - Retrieve all persons, all properties excepts Photo :
_context.Persons.Ignore(p => p.Photo).ToListAsync()

Ex - Retrieve all persons and associated Invoices, excepts photo inside :
_context.Persons.Include(p => p.Invoices.Ignore(i => i.Photo)).ToListAsync()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions