dot connect EF 8.1.26.6 and EntityFunctions
Posted: Tue 03 Dec 2013 17:16
I am using dot connect for Oracle EF version 8.1.26.6, so the new EF 6 version.
From the documentation I think the following query should work:
DateTime? today = DateTime.Today;
using (STUDSYSEntities cntxt = new STUDSYSEntities(_connString))
{
var dois = (from d in cntxt.STUD_CPS_INTERVENTION_DETAIL
where d.END_DATE == null
&& d.STUD_CPS_DETAIL.REMINDER_TO_BE_SENT_YN == "Y"
&& EntityFunctions.DiffDays(d.BEGIN_DATE.Value, today) % 7 == 1
select d).ToList();
return dois;
}
but it throws an error:
LINQ to Entities does not recognize the method 'System.Nullable`1[System.Int32] DiffDays
What is the status of support with the EF 6 and EntityFunctions?
What I am trying to do is select records that have a begin date with a day of week the same as today. I know I could just get all the records from the database and then apply the criteria, but I would like if possible to send the day of week criteria to the database and only bring back the records I am interested in. Is this possible?
From the documentation I think the following query should work:
DateTime? today = DateTime.Today;
using (STUDSYSEntities cntxt = new STUDSYSEntities(_connString))
{
var dois = (from d in cntxt.STUD_CPS_INTERVENTION_DETAIL
where d.END_DATE == null
&& d.STUD_CPS_DETAIL.REMINDER_TO_BE_SENT_YN == "Y"
&& EntityFunctions.DiffDays(d.BEGIN_DATE.Value, today) % 7 == 1
select d).ToList();
return dois;
}
but it throws an error:
LINQ to Entities does not recognize the method 'System.Nullable`1[System.Int32] DiffDays
What is the status of support with the EF 6 and EntityFunctions?
What I am trying to do is select records that have a begin date with a day of week the same as today. I know I could just get all the records from the database and then apply the criteria, but I would like if possible to send the day of week criteria to the database and only bring back the records I am interested in. Is this possible?