I am using .AsExpandable() extension of LinqKIT to dynamically generate Where expression.
For example,
Expression<Func<Asset, bool>> assetNamePredicate = m => m.AssetName == "abc";
Expression<Func<Asset, bool>> assetPurchaseDateFromPredicate = m => m.PurchaseDate > DateTime.Now.AddDays(-10);
Expression<Func<Asset, bool>> whereExpression = t => assetNamePredicate.Invoke(t) && assetPurchaseDateFromPredicate.Invoke(t);
return new entitiesContainer().Set<Asset>().AsExpandable().Where(whereExpression).ToList<Asset>();
Now the Asset entity contains AssetTypeID which is having a foreign key to ID field of AssetType table. But When I try to write Include statement to include AssetType in the resultset, it doesn't work, and the AssetType property for each Asset entity is null always... however, the same thing works fine if I don't use .AsExpandable() extension.
Any idea of how we can use AsExpandable() extension for resultset to load related entities.
P.S. - my scenario is a bit complicated than the sample code I have provide, so I can't avoid using this extension for sure..