我可以添加一个语句,我可以在其中获得申请人上下文不包含 profile_id 或 profile_id 为 NULL 的语句,以便我可以获取所有数据。
这是我的代码:
var applicantList = (from a in context.Profiles
join app in context.APPLICANTs
on a.PROFILE_ID equals app.Profile_id
select new
{
a.PROFILE_ID,
app.APPLICANT_ID,
app.APPLICANT_LastName,
app.APPLICANT_FirstName,
app.APPLICANT_MiddleName,
a.Applicant_LASTNAME,
a.Applicant_FIRSTNAME,
a.Applicant_MIDDLENAME,
a.Applicant_ADDRESS,
a.Applicant_CITY,
a.Applicant_PHONE,
a.Applicant_EMAIL
}).AsEnumerable();
applicantdata = (from s in applicantList
orderby s.APPLICANT_ID
select new APPLICANT()
{
Profile_id = s.PROFILE_ID,
APPLICANT_ID = s.APPLICANT_ID,
APPLICANT_LastName = s.Applicant_LASTNAME,
APPLICANT_FirstName = s.Applicant_FIRSTNAME,
APPLICANT_MiddleName = s.Applicant_MIDDLENAME,
APPLICANT_Address = s.Applicant_ADDRESS,
APPLICANT_City = s.Applicant_CITY,
APPLICANT_Phone = s.Applicant_PHONE,
APPLICANT_Email = s.Applicant_EMAIL
}).AsEnumerable();