使用iqueryable在LINQ(C#)中进行字母数字排序 [英] Alphanumeric sort in LINQ (C#) using iqueryable

查看:240
本文介绍了使用iqueryable在LINQ(C#)中进行字母数字排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能否提供使用iqueryable进行字母数字排序的解决方案。

我使用mysql作为数据库。



我想对它们进行排序仅在数据库中。我不想在记忆中对它们进行排序。



问候,

Santosh



我尝试了什么:



我试过可以使用icomparer进行字母数字排序,但是它不能用于可怜的。

使用icomparer,我们可以在内存中完成。

但我的要求是在数据库本身中按字母顺序对记录进行排序。

Could you please provide solution for alphanumeric sorting using iqueryable.
I am using mysql as database.

I want to sort them in the database only. I dont want to sort them in the memory.

Regards,
Santosh

What I have tried:

I have tried it is possible to use the icomparer for alphanumeric sort but it does not work with iqueryable .
With icomparer, we can do it with in memory.
But my requirement is to sort the records alphanumerically in the database itself.

推荐答案

您不对数据库中的任何内容进行排序:您使用SQL ORDER BY子句作为SELECT操作的一部分,以指定从数据库中提取它们以提供演示软件时的排序顺序。 />


数据库中的数据根据​​用于提供对INDEXed行的有效访问的散列算法进行存储,例如表主键。你不能以任何方式直接影响它。
You don't sort anything in a database: you use SQL ORDER BY clauses as part of the SELECT operation to specify the sort order when they are extracted from the database to feed your presentation software.

Data in a DB is stored according to the hashing algorithm used to provide efficient access to the INDEXed rows, such as the table Primary Key. You can't directly influence that in any way.


这篇关于使用iqueryable在LINQ(C#)中进行字母数字排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆