Using the Code First approach, I created several different objects that inherit from the IConcurrent interface using the IsActive property, for example:
public class Currency : IConcurrent { public string CurrencyId { get; set; } public string Description { get; set; } public bool IsActive { get; set; } }
Every time I select objects, I always have to include a conditional sentence, such as this real basic example:
db.Currencies.Where(c => c.IsActive);
My question is, can I somehow intercept / insert in DbContext so that my LINQ queries always return IsActive == true for objects inheriting the IConcurrent interface so that there is no explicit addition of .Where(c => c.IsActive) each time?
So far, I have been considering possible overriding methods in DbContext that none of them seem to match the count. Can anyone help?
source share