Hi, All.
I have SQL-request:
select FullName, CreatedBy, CreatedOn, DomainName, ModifiedBy from SystemUser
where SystemUserId In (
SELECT SystemUserId
FROM [UserSettings]
where [TimeZoneBias] != -60
and [TimeZoneCode] != 110)
and IsDisabled = 0
I need to convert this request into LINQ.
I wrote this (this is my first LINQ-request):
from s in SystemUserSet
where s.SystemUserId.Contains
(from sy in UserSettingsSet
where sy.TimeZoneBias != -60 && sy.TimeZoneCode != 110
select sy.SystemUserId)
&& s.IsDisabled = 0
select s
And I get error:
'System.Guid?' does not contain a definition for 'Contains' and the best extension method overload 'System.Linq.Queryable.Contains(System.Linq.IQueryable, TSource)' has some invalid arguments
Instance argument: cannot convert from 'System.Guid?' to 'System.Linq.IQueryable>'
Please, could you help with convert?
Thanks!


Kailash Polai195 reputationPosted Jul 9, 2015, 12:45 AM EDT
join q in db.UserSettings on p.SystemUserId equals q.SystemUserId
where q.TimeZoneBias != -60 && q.TimeZoneCode != 110 && p.IsDisabled == false
select new
{
}).ToList();
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 12:38 AM EDT
join m in UserSettings on o.SystemUserId equals m.SystemUserId
where m.TimeZoneBias != -60 && m.TimeZoneCode != 110
&& o.IsDisabled =0
select o;
Sabyasachi MishraRank #889 · 2.4K reputationPosted Jun 16, 2015, 12:41 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 12:44 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 12:48 AM EDT
Abrar Ahmad AnsariRank #3,390 · 425 reputationPosted Jun 16, 2015, 12:48 AM EDT
where sy.TimeZoneBias != -60 && sy.TimeZoneCode != 110
select sy.SystemUserId).ToList();
where SystemUserId.Contains(s.SystemUserId)
&& s.IsDisabled == 0
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 12:49 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 12:50 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 12:53 AM EDT
Sabyasachi MishraRank #889 · 2.4K reputationPosted Jun 16, 2015, 12:53 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 1:06 AM EDT
join m in UserSettings on o.SystemUserId equals m.SystemUserId
where m.TimeZoneBias != -60 && m.TimeZoneCode != 110
&& o.IsDisabled ==false
select o;
Natalija21 reputationPosted Jun 16, 2015, 1:09 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 1:13 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 1:17 AM EDT
join m in UserSettings on o.SystemUserId equals m.SystemUserId
where m.TimeZoneBias != -60 && Convert.ToInt32(m.TimeZoneCode) != Convert.ToInt32(110)
&& o.IsDisabled ==false
select o;
Natalija21 reputationPosted Jun 16, 2015, 1:28 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 1:30 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 1:39 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 1:43 AM EDT
join m in UserSettings on o.SystemUserId equals m.SystemUserId
where m.TimeZoneBias != -60 && Convert.ToInt32(m.TimeZoneCode) != Convert.ToInt32(110)
&& o.IsDisabled ==false
select o;
Natalija21 reputationPosted Jun 16, 2015, 1:48 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 16, 2015, 1:53 AM EDT
Natalija21 reputationPosted Jun 16, 2015, 2:22 AM EDT
Ankit ShuklaRank #2,120 · 672 reputationPosted Jul 7, 2015, 5:47 AM EDT