Hello,
We have a Silverlight RIA application that is using a DomainDataSource
that is bound to a DataGrid. We are using LLBLGEN as our DAL layer.
When I create the following query in our
DomainService.cs code, which orders the results by ClientLabel, ascending,
the DataGrid throws a DomainOperatonException:
"Load operation failed for query 'GetMikesCustomers'. An exception was caught
during the execution of a retrieval query: A column has been specified more
than once in the order by list. Columns n the order by list must be unique."
As you can see in the following query, there is only a single column listed.
When I remove the orderby from the query, and add a SortDescriptor to the
definition of the DomainDataSource in our XAML code, then everything is
fine.
I can rework all of my queries so ordering is done via XAML, but I am wondering
whether you have any ideas as to why this exception is being thrown.
Is there any performance penalty to use the SortDescriptor rather than
an "orderby"?
Thank you for your help!
Mike
=======================================================================
[Query]
[RequiresAuthentication]
public IQueryable<CustomerEntity> GetMikesCustomers()
{
IQueryable<CustomerEntity> entities = null;
DataAccessAdapter adapter = new DataAccessAdapter();
if (adapter == null)
{
throw new NullReferenceException(string.Format(ABitOfHelp.ExpirationTrax.Shared.Resources.Errors.CannotDereferenceNullValue, "adapter"));
}
LinqMetaData linq = new LinqMetaData(adapter);
if (linq == null)
{
throw new NullReferenceException(string.Format(ABitOfHelp.ExpirationTrax.Shared.Resources.Errors.CannotDereferenceNullValue, "linq"));
}
entities =
(from c in linq.Customer
[b]orderby c.CustomerLabel ascending[/b]
select c);
return entities;
}
=====================================================================
<riaControls:DomainDataSource
x:Name="customersDomainDataSource"
AutoLoad="True"
LoadSize="50"
d:DesignData="{d:DesignInstance dal:CustomerEntity, CreateList=true}"
Height="0"
LoadedData="CustomersDomainDataSource_LoadedData" QueryName="GetMikesCustomersQuery"
SubmittedChanges="CustomersDomainDataSource_SubmittedChanges" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:ExpirationTraxDomainContext />
</riaControls:DomainDataSource.DomainContext>
[b] <riaControls:DomainDataSource.SortDescriptors>
<riaControls:SortDescriptor PropertyPath="CustomerLabel" Direction="Ascending" />
</riaControls:DomainDataSource.SortDescriptors>[/b] </riaControls:DomainDataSource>