Reputation: 5730
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.
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.
Upvotes: 0
Views: 238
Reputation: 10416
Assuming that you're using standard names for your navigation properties you should be able to do this:
Repository.Query(level => level.Title.Entity.EntityId == selectedId);
If not, can you post your model?
Upvotes: 1