With this code:
PrefetchPath2 prefetch = new PrefetchPath2((int)EntityType.SecurityUserEntity);
prefetch.Add(SecurityUserEntity.PrefetchPathSecurityRoles);
adapter.FetchEntityUsingUniqueConstraint(user,
user.ConstructFilterForUCName(),
prefetch)
I can get this query:
SELECT DISTINCT
[SecurityRole].[SecurityRoleID] AS [SecurityRoleId],
[SecurityRole].[Name],
[SecurityRole].[CreateDate],
[SecurityRole].[CreateBy],
[SecurityRole].[UpdateDate],
[SecurityRole].[UpdateBy]
FROM
((( [SecurityUser] [LPA__1]
INNER JOIN [SecurityUserApplicationRole] [LPA_S2] ON
[LPA__1].[SecurityUserID]=[LPA_S2].[SecurityUserID] )
INNER JOIN [SecurityRole] ON
[SecurityRole].[SecurityRoleID]=[LPA_S2].[SecurityRoleID]))
WHERE
( ( [LPA_S2].[SecurityUserID] = 1))
All I want to do is change the first INNER JOIN to:
INNER JOIN [SecurityUserApplicationRole] [LPA_S2] ON
[LPA__1].[SecurityUserID]=[LPA_S2].[SecurityUserID] AND [LPA_S2].[ApplicationID] = 1)
Call me silly but by my intuition this should work
IPrefetchPathElement2 rolePath = prefetch.Add(SecurityUserEntity.PrefetchPathSecurityRoles);
rolePath.Relation.CustomFilter.Add(SecurityUserApplicationRoleFields.ApplicationId == 1);
Edit
but rolePath.Relation is null. Seems like the prefetch path would know that relation and expose it for just this scenario. I'm sure there's something going on here that i don't understand, but this is how i expected it to work
Please help me solve this seemingly simple problem.
I'm stumped and would appreciate any assistance anyone can provide