Most of my entities (not all) have two properties called CompanyId and Deleted. How would be possible to auto insert these two properties for all select requests instead of setting manually on every single query I have along the whole app.
Example:
db.MyEntity.Where(me => me.Id == 1).Select(me => me.Description)
- Check dynamically it the entity has the props
CompanyIdandDeleted. - Case affirmative, transform it like this
db.MyEntity.Where(me => me.Id == 1 && Deleted == false && CompanyId == 1).Select(me => me.Description)
- Case negative, keep the same select query.
It would help me having to set these conditions to all my queries in which has the properties available.