Is it possible to write an extension to EF Core that tells it how to translate expression bodied members (or methods) to SQL so a getter/method can be used in where-clauses?
What I would like to achieve is the following:
public class Entity
{
public bool Deleted { get; set; }
public bool IsDeleted => Deleted;
}
public class Repository(ApplicationDbContext db)
{
public Task<List<Entity>> GetDeletedEntities()
{
return db.Set<Entity>().Where(e => e.IsDeleted).ToListAsync();
}
}