I am trying to convert the following SQL query to linq;
select Or.Amount, Usr.Name, Usr.Email from [order] as Or left join vw_AllUsers as Usr on Usr.UserId = Or.UserId and Usr.RoleName <> 'Admin'
I could not find a way to use equal and not equal in the same connection. If Usr.RoleName <> 'Admin' was Usr.RoleName = 'Admin' , the linq operator could be written like this:
var result = from Or in context.orders join Usr in context.vw_AllUsers on new { userid = Or.UserId, role = "Admin"} equals new { userid = Usr.UserId, role = Usr.RoleName} select ........
or I can process it where the linq part gets the same result as below.
where !Usr.RoleName.Equals("Admin")
but is it possible to handle this in part of the linq connection?
Thanks in advance
source share