我想将以下实体框架代码转换为SQL命令:
public IEnumerable<Tuple<FILES, string>> GetAllActivesFilesForClient(long clientId)
{
var fileList = _db.SIGN_UP_REQUEST_ITEM.Where(d => d.CLIENT_ID == clientId)
.GroupJoin(_db.USER_FILES, signup => signup.SIGN_UP_REQUEST_ID, userFile => userFile.SIGN_UP_REQUEST_ID, (signup, userFile) => new { SIGN_UP_REQUEST_ITEM = signup, USER_FILES = userFile })
.SelectMany(p => p.USER_FILES.DefaultIfEmpty(), (x, y) => new { USER_FILES = y, x.SIGN_UP_REQUEST_ITEM })
.GroupJoin(_db.FILES, userFile => userFile.USER_FILES.FILE_ID, File => File.FILE_ID, (userFile, File) => new { USER_FILES = userFile, FILES = File })
.SelectMany(p => p.FILES.DefaultIfEmpty(), (x, y) => new { FILES = y, x.USER_FILES.USER_FILES })
.GroupJoin(_db.ACCOUNTS_FILES, file => file.FILES.FILE_ID, accountFile => accountFile.FILE_ID, (file, accountFile) => new { ACCOUNTS_FILES = accountFile, FILES = file })
.SelectMany(p => p.ACCOUNTS_FILES.DefaultIfEmpty(), (x, y) => new { ACCOUNTS_FILES = y, x.FILES })
.GroupJoin(_db.ACCOUNT_CREATION_REQUEST_ITEM, accountFile => accountFile.ACCOUNTS_FILES.REQUEST_ID, request => request.REQUEST_ID, (accountFile, request) => new { ACCOUNTS_FILES = accountFile, ACCOUNT_CREATION_REQUEST_ITEM = request })
.SelectMany(p => p.ACCOUNT_CREATION_REQUEST_ITEM.DefaultIfEmpty(), (x, y) => new { ACCOUNT_CREATION_REQUEST_ITEM = y, x.ACCOUNTS_FILES })
.GroupJoin(_db.ACCOUNT_TYPE, accountRequest => accountRequest.ACCOUNT_CREATION_REQUEST_ITEM.ACCOUNT_TYPE_ID, accountType => accountType.ACCOUNT_TYPE_ID, (accountRequest, accountType) => new { ACCOUNT_TYPE = accountType, ACCOUNT_CREATION_REQUEST_ITEM = accountRequest })
.SelectMany(p => p.ACCOUNT_TYPE.DefaultIfEmpty(), (x, y) => new { ACCOUNT_TYPE = y, x.ACCOUNT_CREATION_REQUEST_ITEM })
.Select(x => new { x.ACCOUNT_CREATION_REQUEST_ITEM.ACCOUNTS_FILES.FILES, x.ACCOUNT_TYPE.ACCOUNT_NAME })
.AsEnumerable()
.Select(t => new Tuple<FILES, string>(t.FILES.FILES, t.ACCOUNT_NAME)).ToList();
return fileList;
}
你能帮我转换一下吗?
非常感谢你的帮助。
打开EF日志或使用Profiler/SQL Trace/XEvents查看EF生成的SQL查询