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
|
Guys lightspeed is telling me the following query is not supported: uow.Events.Where(e => (e.DateTime.HasValue) ? e.DateTime.Value.Date == date.Date : false); thoughts?? |
|
|
While this is still an issue I have got around the problem for now by simply setting the DateTime to non nullable however another problem has arised, when i perform my LAMBDA query it executes th first part of the query against the database and then executes the second part of the query against the already loaded entities, how can I execute the whole query in one go to the database?
var query = uow.Find<Event>(Event.Attribute("EventType").In(eventTypeCodes.Cast<object>().ToArray())) .Where(e =>e.DateTime.Date == date.Date); |
|
|
While this is still an issue I have got around the problem for now by simply setting the DateTime to non nullable however another problem has arised, when i perform my LAMBDA query it executes th first part of the query against the database and then executes the second part of the query against the already loaded entities, how can I execute the whole query in one go to the database?
var query = uow.Find<Event>(Event.Attribute("EventType").In(eventTypeCodes.Cast<object>().ToArray())) .Where(e =>e.DateTime.Date == date.Date);
|
|
|
Hi Josh, UnitOfWork.Find returns a list of entities, which you are then performing a Linq to Objects query on which is what you are seeing. To perform this as a single query just structure it similar to your original query by using the LINQ provider over .Events - e.g. uow.Events.Where(e => eventTypeCodes.Cast<object>().ToArray().Contains(e.EventType) && e.DateTime.Date == date.Date);
Jeremy |
|
|
it would appear that lightspeed does not support that statement either. I'm running 3.11 |
|
|
Yes, I would say that is to do with the .Cast<object> call which I assume is a local extension method you have? If so try getting the array of values out prior to passing it in to the call - we dont allow client code to be handled within a server based statement :)
Jeremy |
|