代码如下:
var query = from s in db.LoginUserServices join ss in db.Services on s.ServiceType equals ss.Code into s_ss_join from s_ss in s_ss_join.DefaultIfEmpty() where s.LoginUserID.Equals(LoginUserID) select new { // ServiceType = s.ServiceType, ServiceName = s_ss.Name, ServiceProperty = s_ss.Property, ServiceCode = s.ServiceType };
Linq to Array中报错:
报错位置:
Equals
改为:
var query = from s in db.LoginUserServices join ss in db.Services on s.ServiceType equals ss.Code into s_ss_join from s_ss in s_ss_join.DefaultIfEmpty() where s.LoginUserID==LoginUserID select new { // ServiceType = s.ServiceType, ServiceName = s_ss.Name, ServiceProperty = s_ss.Property, ServiceCode = s.ServiceType };