This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to migrate an existing application to OpenAccess and ran into a problem:
Here's my linq query:
And here's the generated SQL:
Note the last row: d.[GroupCode] = d.[GroupCode]
It should be d.[GroupCode] = c.[GroupCode]
On a side note the GroupCode (nvarchar) field is in fact a foreign key from table GroupMember to table CGroup, but OpenAccess didn't generate any relationships there, that's why the reach out to model.GroupMembers is there.
Thanks,
Levente
I'm trying to migrate an existing application to OpenAccess and ran into a problem:
Here's my linq query:
var q = model.DocImages.Where(doc =>
(
doc.Category.CGroups.Any(cg =>
cg.ACL.Contains(
"R"
)
&& model.GroupMembers.Count
(gm => gm.UserName ==
"xyz"
&& gm.GroupCode == cg.GroupCode) > 0)
)
);
SELECT
TOP
(??T) a.[DocID]
AS
COL1
FROM
[dbo].[Doc] a
WHERE
EXISTS
(
SELECT
1234567
FROM
[dbo].[Category] b
WHERE
a.[CategoryID] = b.[CategoryID]
AND
((EXISTS
(
SELECT
1234567
FROM
[dbo].[CGroup] c
WHERE
b.[CategoryID] = c.[DimCategoryID]
AND
c.[ACL]
LIKE
'%R%'
ESCAPE
'\'
AND (SELECT COUNT(1) FROM [dbo].[GroupMember] d
WHERE d.[UserName] = '
xyz'
AND
d.[GroupCode] = d.[GroupCode]) > 0)
))
)
Note the last row: d.[GroupCode] = d.[GroupCode]
It should be d.[GroupCode] = c.[GroupCode]
On a side note the GroupCode (nvarchar) field is in fact a foreign key from table GroupMember to table CGroup, but OpenAccess didn't generate any relationships there, that's why the reach out to model.GroupMembers is there.
Thanks,
Levente