简体   繁体   English

Firebase.Xamarin的OrderBy()方法不对数据进行排序

[英]OrderBy() method of Firebase.Xamarin doesn't sort the data

This is a question about Firebase.Xamarin NuGet package. 这是有关Firebase.Xamarin NuGet软件包的问题。 I'm using the statement await Client.Child(FirebaseKeys.Users).OrderBy("FirstName").OnceAsync<object>(); 我正在使用语句await Client.Child(FirebaseKeys.Users).OrderBy("FirstName").OnceAsync<object>(); to sort the users by first name, but I don't get the users in sorted order. 按名字对用户进行排序,但我没有按排序顺序获得用户。 In the source code there is a comment stating that "this is used mainly for following filtering queries and due to firebase implementation the data may actually not be ordered." 在源代码中,有一条注释指出“此命令主要用于跟踪筛选查询,由于实施了Firebase,因此实际上可能未对数据进行排序”。 I'm not sure whether it's even possible to sort the data at all. 我不确定是否可以对数据进行排序。

If you look at the Firebase.Xamarin Github Code, it clearly states in the method documentation as such: 如果查看Firebase.Xamarin Github代码,则它在方法文档中明确指出如下:

        /// <summary>
        /// Order data by given <see cref="propertyName"/>. Note that this is used mainly for following filtering queries and due to firebase implementation
        /// the data may actually not be ordered.
        /// </summary>
        /// <param name="child"> The child. </param>
        /// <param name="propertyName"> The property name. </param>
        /// <returns> The <see cref="OrderQuery"/>. </returns>
        public static OrderQuery OrderBy(this ChildQuery child, string propertyName)
        {
            return child.OrderBy(() => propertyName);
        }

In effect, the data may not be sorted as required. 实际上,数据可能未按要求排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM