LinqToSql Sub Entiity Multiple And Operators
- by halit
Hi I have an Array of Featureset Id , My Vehicles table has got sub table as FeatureSets
I wrote Sql Query Like
SELECT [t0].[ID]
FROM [dbo].[SearchResultView] AS [t0]
Join [dbo].[VehicleFeatureSet] AS [t1] on t0.ID = t1.VehicleID
where t1.FeatureSetID = 1 and t1.FeatureSetID= 2 and t1.FeatureSetID= 3
I tried. But I Couldn't
var features = Request.QueryString["FeatureSets"].Split(',').ToList().ConvertAll(new Converter<string, int>(StrinToint));
IQueryable<SearchResultView> result = db.SearchResultViews.Where(m => m.Active == true);
foreach (var featuree in features)
{
result = result.Where(m => m.VehicleFeatureSets.Any(c => c.FeatureSetID == featuree));
}
How Can I write this LINQ Query