Thx Marvin!
The All method requires a predicate so this:
q.AndWhere(
(
qf.Deelplan
.CorrelatedOver(DeelplanFields.PlanId == PlanFields.Id)
.From(QueryTarget.InnerJoin(qf.Variant).On(VariantFields.DeelplanId == DeelplanFields.Id))
.Where(variantFilter).Select(DeelplanFields.PlanId).Any()
).Or(
qf.Deelplan
.CorrelatedOver(DeelplanFields.PlanId == PlanFields.Id)
.Select(DeelplanFields.PlanId).All(DeelplanFields.PlanId == DeelplanFields.PlanId) //don't know what do add here...
)
);
produces the following:
OR NOT EXISTS (SELECT [dbo].[Deelplan].[PlanID] AS [PlanId] FROM [dbo].[Deelplan] WHERE ( ( NOT [dbo].[Deelplan].[PlanID] = [dbo].[Deelplan].[PlanID]) AND ( [dbo].[Deelplan].[PlanID] = [dbo].[Plan].[ID])))
So to get ride of the NOT [dbo].[Deelplan].[PlanID] = [dbo].[Deelplan].[PlanID]
I changed it to this:
q.AndWhere(
(
qf.Deelplan
.CorrelatedOver(DeelplanFields.PlanId == PlanFields.Id)
.From(QueryTarget.InnerJoin(qf.Variant).On(VariantFields.DeelplanId == DeelplanFields.Id))
.Where(variantFilter).Select(DeelplanFields.PlanId).Any()
).OrNot(
qf.Deelplan
.CorrelatedOver(DeelplanFields.PlanId == PlanFields.Id)
.Select(DeelplanFields.PlanId).Any()
)
);
Me right now =>