Hi,
for the last couple of hours I've been trying to use LinqToCsla and I'm somehow lost:
I have a BO TaskEdit which contains an editable List of other BOs. Now I try to sort the list by a simple DateTime property:
private
static readonly PropertyInfo<UrgencyEditCollection> urgenciesProperty = RegisterProperty<UrgencyEditCollection>(c => c.Urgencies);public LinqBindingList<UrgencyEdit> Urgencies
{
get
{
return from urgency in GetProperty(urgenciesProperty)
orderby urgency.StartDate
select urgency;
}
}
VS2008 makes a red line below the Linq Query and the message is:
Cannot convert expression type 'System.Linq.IOrderedQueryable<Tasks.Library.UrgencyEdit>' to return type 'Csla.LinqBindingList<Tasks.Library.UrgencyEdit>'
Both TaskEdit and UrgencyEdit derive indirectly via 2 additional base classes from BusinessBase. UrgencyEditCollection derives directly from BusinessListBase.
Thanks for any hints.
Luzius
Are you using the 3.6.2 release candidate?
I know there were some issues with orderby not returning a LinqBindingList that have (hopefully) been addressed in 3.6.2.
Thanks,
I somehow thought that no explicit cast was necessary - my fault.
This way it works very well, even with more than one orderby criteria. (I think this was the issue with the 3.6.2 beta).
I still have an issue with binding this list to a WPF ListBox. When I bound the original BusinessListBase Collection to the Listbox, all updates to the list were automatically displayed. Now after binding the LinqBindingList, I have to call Rebind() in the CslaDataProvider. Is this necessary or am I doing something wrong?
Luzius
Luzius:Thanks,
This way it works very well, even with more than one orderby criteria. (I think this was the issue with the 3.6.2 beta).
Copyright (c) Marimer LLC