注意看以下LINQ的写法.
var modeltest1 = db.SysUsers.Where(m => m.State != 0
&& string.IsNullOrEmpty(User_Name) ? true : m.Name.Contains(User_Name));
var modeltest2 = db.SysUsers.Where(m => m.State != 0
&& (string.IsNullOrEmpty(User_Name) ? true : m.Name.Contains(User_Name)));
var modeltest3 = db.SysUsers.Where(m =>
string.IsNullOrEmpty(User_Name) ? true : m.Name.Contains(User_Name)
&& m.State != 0);
var modeltest4 = db.SysUsers.Where(m =>
(string.IsNullOrEmpty(User_Name) ? true : m.Name.Contains(User_Name))
&& m.State != 0);
系统翻译为
Modeltest1
SELECT *
FROM [dbo].[SysUser] AS [Extent1]
新闻热点
疑难解答