Entity Framework AddDays

Entity Framework AddDays

Postby sweil » Mon 10 Nov 2014 03:40

Hi,

Can I use System.Data.Objects.EntityFunctions.AddDays or similar with the Devart PostgreSql data provider. I can't find the function in Devart.Data.PostgreSql.Entity.

I want to do something like this:

DbContext.Entity.Where(x => x.dateColumn.AddDays(x.lengthColumn))

or

DbContext.Entity.Where(x => PgSqlFunctions.AddDays(x.dateColumn ,x.lengthColumn))

Thanks,
Simon
sweil
 
Posts: 1
Joined: Mon 10 Nov 2014 03:32

Re: Entity Framework AddDays

Postby MariiaI » Tue 11 Nov 2014 13:05

The DateTime.AddDays method is not supported in LINQ to Entities. You can use the EntityFunctions.AddDays method for this (System.Data.Entity.DbFunctions.AddDays for EF6).
Please refer to http://blog.devart.com/entity-framework-canonical-functions.html, the "Date and Time Canonical Function" section (the EntityFunctions.AddDays is supported in dotConnect for PostgreSQL).

Some useful information is also available here:
http://stackoverflow.com/questions/4146300/linq-to-entityframework-datetime

If you encounter any further issues with this, feel free to contact us.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for PostgreSQL