This question is locked. New answers and comments are not allowed.
I am attempting to build a dynamic LINQ query to filter users. Here is my code so far:
The problem I am having is that the where clause is not being applied to the LINQ query. If I set a username of 'blah' the linq query still returns all users regardless. What am I doing wrong?
Thanks
'Initialise the contexts
Dim
portal
As
New
Domain.vPortal.DbContext
'Get the basic user search
Dim
search = (From u
In
portal.Users
Select
u)
'Apply the filter criteria
If
Not
filter.Name
Is
Nothing
Then
search.Where(
Function
(e) e.Username = filter.Name)
End
If
'Get the results
Dim
results = search.ToList
The problem I am having is that the where clause is not being applied to the LINQ query. If I set a username of 'blah' the linq query still returns all users regardless. What am I doing wrong?
Thanks