Check username and password in LINQ query
- by b0x0rz
this linq query
var users = from u in context.Users
where u.UserEMailAdresses.Any(e1 => e1.EMailAddress == userEMail) && u.UserPasswords.Any(e2 => e2.PasswordSaltedHash == passwordSaltedHash)
select u;
return users.Count();
returns: 1 even when there is nothing in password table.
how come?
what i am trying to do is get the values of email and passwordHash from two separate tables (UserEMailAddresses and UserPasswords) linked via foreign keys to the third table (Users).
it should be simple - checking if email and password mach from form to database. but it is not working for me.
i get 1 (for count) even when there are NO entries in the UserPasswords table.
is the linq query above completely wrong, or...?