var temp = userDb.U_AccountLog.Join(userDb.Users, l => l.UserId, u => u.Id, (l, u) => new PVM_CashLog() { LogType = 0, UseType = l.LogType.HasValue ? (int)l.LogType : 0, Type = l.Type, ItemId = SqlFunctions.StringConvert(l.ALId*1M),//转换成字符 Mobile = u.Mobile, UserName = u.LoginName, Price = l.Price, CreateTime = l.Createtime, }).Union(userDb.U_KBLog.Where(l => l.State == 1).Join(userDb.Users, l => l.UserId, u => u.Id, (l, u) => new PVM_CashLog() { LogType = 1, UseType = l.LogType.HasValue ? (int)l.LogType : 0, Type = l.Type, ItemId = l.OrderNum, Mobile = u.Mobile, UserName = u.LoginName, Price = l.Price, CreateTime = l.Createtime }));
关键代码:ItemId = SqlFunctions.StringConvert(l.ALId*1M),//转换成字符
用这种方式可以将ALId转成string,但是感觉怪怪的,l.ALId.ToString()是会报错的。
求教大神,还有其它写法么?
没有了。