I have a daschema with the sql statement you see below.
I cannot get this to work with linq however
Without UseDynamicWhere=true I get an error because of select * from (with ....
With that statement I get
I don’t see the offending select in the sql profiler or in my own logs.
As a second issue: I would like to get my own log working for the linq statements but this does not work because the GetData (where my logging is implemented) does not get called.
WITH vRekeningTotalen
AS (SELECT rek_primkey,
COALESCE(Sum(kor_AantalVrk),0) AS TotaalAantalVrk, COALESCE(Sum(kor_Totaal),0) AS Totaal,
COALESCE(Sum(kor_kortBtw1),0) AS TotaalBTW1, COALESCE(Sum(kor_kortBtw2),0) AS TotaalBTW2,
COALESCE(Sum(kor_kortBtw3),0) AS TotaalBTW3, COALESCE(Sum(kor_kortBtw4),0) AS TotaalBTW4
FROM Rekening
LEFT JOIN Korting ON kor_rek_Primkey=rek_primkey and kor_Status=0 --alleen de nog niet gereleasede
GROUP BY rek_primkey)
SELECT
rek.rek_primkey, rek_Datechanged, rek_UserId, rek_Naam, rek_typ_primkey, rek_ReleaseVirtueleGrens, rek_ReleaseId, rek_DatumLaatsteRelease,
typ_primkey, typ_datechanged, typ_userid, typ_Omschrijving, typ_Type, typ_ReleaseDatum, typ_ReleaseAantalVrk,
typ_ReleaseBedrag, typ_CardScanNodig,
typ_ReleaseType, typ_VraagVoorRelease, typ_HoudRestbedrag, typ_ReleaseBedragExact, typ_SisCardSupported,
TotaalAantalVrk, Totaal, TotaalBTW1, TotaalBTW2, TotaalBTW3, TotaalBTW4
FROM Rekening rek
INNER JOIN vRekeningTotalen ON vRekeningTotalen.rek_primkey=rek.rek_primkey
INNER JOIN RekeningType typ ON rek_typ_primkey=typ_primkey
WHERE {Where}
