In EF generic repoistory my Query method is as below:
public IEnumerable<T> Query(Expression<Func<T, bool>> filter)
{
return objectSet.Where(filter);
}
I have used this method to filter data like:
Repository.Query(a=>a.EntityId==selectedId);
Below is my tables structure.
- Entity (Id, Name)
- Title (Id,Name,EntityId)
- Level (Id, Name,TitleId)
I know EntityId and based I want to filter data from Level table but Entity and Levle table are not connected directly, Level is attaching them.
Please guide how I should write write lambda expression to pass to Query method.
Thanks
Edit
ObjectSet type is Level.
Assuming that you’re using standard names for your navigation properties you should be able to do this:
If not, can you post your model?