C#C
C#4y ago
Tvde1

Query over multiple entities using the same interface [Answered]

I have a EF setup, where ~20 entities implement IArchivable
This interface has a public
public Guid Id { get; }
public Guid IsArchived { get; set; }

I wish to perform a query to find the entity with a certain id, and then another query to set the IsArchived property to false.
Is this possible with EF? (something like _context.Set<IArchivable>().Where(...) Or should I loop through all types (using reflection) and build an IQueryable for each of them?
Was this page helpful?