SqlFunctions.DatePart with dotConnect

SqlFunctions.DatePart with dotConnect

Postby raffaelbechara » Thu 23 Jul 2015 20:38

Can I use SqlFunctions.DatePart( ) with dotConnect for Oracle? (Linq to Entities)

If not, what is an alternative? OracleFunctions class?

If so, can you give an example please?

Thanks
raffaelbechara
 
Posts: 3
Joined: Thu 09 Jul 2015 13:47

Re: SqlFunctions.DatePart with dotConnect

Postby Shalex » Fri 24 Jul 2015 09:52

We will notify you when SqlFunctions.DatePart( ) is supported in dotConnect for Oracle.

As a workaround, please use the properties of the object:
Code: Select all
//var a1 = context.TSTABLEs.Where(b => SqlFunctions.DatePart("year", b.TSCOLUMN) == 2015).ToList();
var a2 = context.TSTABLEs.Where(b => b.TSCOLUMN.Value.Year == 2015).ToList();
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Re: SqlFunctions.DatePart with dotConnect

Postby raffaelbechara » Fri 24 Jul 2015 16:59

Thank you for replying. Therefore, I'm still with a problem:

I can't use object property "Offset" because calling it throws an "unsupported" exception:
Code: Select all
b.Value.Offset


It works fine with properties like Day, Year, and some others. Therefore, I really need the "Offset" property.

Any suggests please?
raffaelbechara
 
Posts: 3
Joined: Thu 09 Jul 2015 13:47

Re: SqlFunctions.DatePart with dotConnect

Postby Shalex » Tue 28 Jul 2015 06:43

Try this way:
Code: Select all
var a3 = context.TSTABLEs.Where(b => System.Data.Entity.DbFunctions.GetTotalOffsetMinutes(b.TSCOLUMN) == 60).ToList();
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Re: SqlFunctions.DatePart with dotConnect

Postby Shalex » Thu 07 Jul 2016 17:21

The SqlFunctions.DatePart method is supported in LINQ to Entities for the following modifiers: year, month, day, hour, minute, second, millisecond, tzoffset. The feature is available in the newest (9.1.55) build of dotConnect for Oracle.
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle