Hi.
I have like 50 entities in my model and the 30 of them have the same property : Id_Parent (Just the same name and type, they are not inheriting from a base entity)
All queries must have this property included in the Where clause. In order to avoid developers from forgetting to include this property in their queries, I am using a custom EntityServerQueryInterceptor. So, for my 30 entities I have in my interceptor:
int idParent= GetIdParent(); this.QueryFilters.AddFilter<Entity1>(q => q.Where(i => i.Id_Parent== idParent)); this.QueryFilters.AddFilter<Entity2>(q => q.Where(i => i.Id_Parent== idParent)); ... this.QueryFilters.AddFilter<Entity30>(q => q.Where(i => i.Id_Parent== idParent));
|
Is this the best approach? Now, I need to add another 20 entities to my model, and all of them have this property. Do I have to another 20 filters? What about the performance?