Page 1 of 1

Entity Framework AddDays

Posted: Mon 10 Nov 2014 03:40
by sweil
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

Re: Entity Framework AddDays

Posted: Tue 11 Nov 2014 13:05
by MariiaI
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 ... tions.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/4146 ... k-datetime

If you encounter any further issues with this, feel free to contact us.