Page 1 of 1

Missing query operator support in Devart.Data.Linq

Posted: Fri 11 Sep 2009 13:30
by klay
Hi,

I'm a relatively new user of dotConnect for Oracle. When I try to construct the following Linq statement:

Code: Select all

var range = 
				from p in context.PreprocessingDatas
				where p.DateTime != DateTime.MinValue
				orderby p.DateTime
				select p
			;
		
			// setup default start and end dates for queries
			startDate = range.First().DateTime;
			endDate = range.Last().DateTime;

and I get the following error:

"The query operator 'Last' is not supported."

The same error occurs when I use 'LastOrDefault'. Are these operators really not supported? If not, in which contexts?

Posted: Tue 15 Sep 2009 08:02
by Paul
Yes. It is not supported in Linq To SQL.
Implementation of Linq To SQL by Microsoft does not support it too.
There is no simple way to translate this to SQL. Try to use Skip, Take instead