I have a table called source that has multiple derived tables such as account, etc. I have a second table that has a navigation property to that table called Source.
What I’d like to do is filter the results of ActionItemState by the type of the Source then filter based on a property of that inherited table.
Here is an example of what I’m trying to do. I get “. LINQ to Entities only supports casting EDM primitive or enumeration types” when I try the code below. Does anyone know of a way to use OfType or something similar?
query = from a in _actionItemRepository.GetTable()
where a.ActionItemStates.Any(ais => ais.Source is AccountSource && ((AccountSource)ais.Source).AccountId == id)
select a;

Try going the other way with it: