Home > Net >  When the uncertainty of linq syntax, how to deal with?
When the uncertainty of linq syntax, how to deal with?

Time:02-23

I have a linq syntax is used to search database as follows:

 a=& gt; A.t dIsDelete!=true & amp; & A.u Status & gt;=0 & amp; & ((a.u LoginName!=null & amp; & A.u LoginName. The Contains (key)) | | (a.u RealName!=null & amp; & A.u RealName. The Contains (key))) 


Among them, (uLoginName) and (uRealName) is currently the or, but I hope to parameters according to the user to query,

Variables such as: [bLoginName=true] and [variables bRealName=false], only confirm whether uLoginName contain key, and don't care whether uRealName has contains,

This time I hope linq syntax is as follows:
 a=& gt; A.t dIsDelete!=true & amp; & A.u Status & gt;=0 & amp; & ((a.u LoginName!=null & amp; & A.u LoginName. The Contains (key))) 


But can you tell me how to do? Thank you,
  •  Tags:  
  • LINQ
  • Related