-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using DataSourceLoader with custom sort #388
Comments
You can use the DataSourceLoadOptionsBase.DefaultSort property or build a custom sort list: var mySort = . . .;
loadOptions.Sort = mySort; The following support ticket may be relevant: |
@AlekseyMartynov Well, that most probably won't work if I were to use a client side projection. |
Would you please add a code sample to illustrate what exactly won't work? Internally, db.Items.OrderBy(i => i.Name).Select(i => i.Name)
.Where(...)
.OrderBy(...) Subsequent Alternatively, we can add a boolean option to prevent any sort inside |
@AlekseyMartynov Sorry for the delay Imagine a projection to a class ClientSide {
public string LowercaseName { get; set; }
}
DataSourceLoader.Load(db.Items.Select(i => new ClientSide { LowercaseName = string.ToLower(i.Name) } , loadOptions}); Perhaps I'm wrong, but Select in this case is client side and applying sort and/or filter on it, would cause a problem because it will have to fetch all the data from the database first. |
Thank you for the update. Now I better understand the issue. You need to sort original items by I just posted a comment about DTO mapping. Please review it and let me know if such a feature would address your requirements. In the interim, check if you can use the workaround suggested in #378 (comment). |
For various reasons, I want to pass an IQueryable containing an OrderBy statement to DataSourceLoader.Load.
Basicallly something like
When working with version 2.4.4
Load did honor the OrderBy, but 2.5.0 ignores it completely (both ignore it actually). So, how I go with custom sorting in this case?The text was updated successfully, but these errors were encountered: