Yep, you already have a massive if in there: GetQueryableForEntity.
Imagine you have this:
interface IMyEntity {
int Id { get; }
}
a method
EntityCollection2<TMyEntity> DoSomethingWith<TMyEntity>
where TMyEntity: CommonEntityBase, IMyEntity
()
{
...
}
and you want to, let's say, do a query that returns TMyEntity collection based on its Id, like
from e in new LinqMetaData().Entities<TMyEntity>() where e.Id == SomeId select e;