This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have: CREATE TABLE Period
List<Period> periodList = ( Following exception is thrown: Query Error: Could not find field [Value] on model ...
|
|
|
Thanks for letting us know about this. I have fixed the issue with using Nullable<> Value and HasValue properties and this fix will be included in the 17 June nightly build, available after about 1430 GMT. However please note that the Date property is not supported on all databases. (I think it is available only Oracle and PostgreSQL.) So you may need to reformulate your query along the lines of: period.DateTime_From.Value <= someDate.Date and similarly for DateTime_To. (The exact reformulation will depend on whether someDate is a date or a date-time.) |
|
|
ok, but i have additional question, it is not directly related with my problem, but intresting for me: what part of a database server may does not support DateTime.Date property? When i run following LINQ query: var pl = (from period in dataContext.Periods where period.Date_To.Value.Date < DateTime.Now.Date select period).ToList(); Microsoft LINQ to SQL Server makes following query to database: exec sp_executesql N'SELECT [t0].[Id], [t0].[Date_From], [t0].[Date_To] |
|
|
In our case, the issue is not that the Date property can't in principle be translated to SQL Server or MySQL or whatever, but that the syntax required to translate them is not yet supported by the LightSpeed core, and/or that the translation would be extremely complex. A specific limitation is that the LightSpeed core doesn't yet support passing unquoted strings to functions: this prevents us from calling functions like DATEPART(HOUR, tbl.Date_To). (The closest we could currently get is DATEPART('HOUR', tbl.Date_To), with the quotes, which is not what SQL Server wants.) As you can see, removing this limitation -- and thereby enabling the Date property -- is not an issue with the database server: it's a matter of us finding the resources to implement the necessary enhancement(s) to the LightSpeed core and, in the case of the Date property, to implement the relatively complex translation required for SQL Server. Hope this clarifies things! |
|