从巨大的表中自动完成数据字符串

时间:2021-07-12 07:32:25

I need to provide AutocompleteBox that will give user ability to input data. Completion should be provided for string field(for example: UserName). The issue is that source DB table consist of hundred of thousands records with 10 fields.

我需要提供AutocompleteBox,它将为用户提供输入数据的能力。应为字符串字段提供完成(例如:UserName)。问题是源数据库表由包含10个字段的数十万条记录组成。

How can I handle this in Silverlight?

我如何在Silverlight中处理这个问题?

1 个解决方案

#1


3  

First, keep your service payload as small as possible. The AutoCompleteBox should only need one or two fields - a key and value pair - so that when they select the item, your application can then make another query to fetch the rest of the data for that particular record.

首先,保持您的服务有效负载尽可能小。 AutoCompleteBox应该只需要一个或两个字段 - 键和值对 - 这样当他们选择项目时,您的应用程序可以再次进行查询以获取该特定记录的其余数据。

Second, I recommend paging your auto-complete results. Don't make the initial query until the user has entered two or three characters into the AutoCompleteBox. Once they do, query the database to get a subset of values that closer match their criteria. If they remove characters, you will need to re-query the table to change the data source values.

其次,我建议分页你自动完成的结果。在用户在AutoCompleteBox中输入两到三个字符之前,请不要进行初始查询。完成后,查询数据库以获取更接近其条件的值的子集。如果删除字符,则需要重新查询表以更改数据源值。

The key is to 1) index your table based on the string values and 2) bring back as little as possible from the server to the client so that you keep your network payload small.

关键是1)根据字符串值索引表格,2)尽可能少地从服务器返回到客户端,以便保持网络有效负载较小。

#1


3  

First, keep your service payload as small as possible. The AutoCompleteBox should only need one or two fields - a key and value pair - so that when they select the item, your application can then make another query to fetch the rest of the data for that particular record.

首先,保持您的服务有效负载尽可能小。 AutoCompleteBox应该只需要一个或两个字段 - 键和值对 - 这样当他们选择项目时,您的应用程序可以再次进行查询以获取该特定记录的其余数据。

Second, I recommend paging your auto-complete results. Don't make the initial query until the user has entered two or three characters into the AutoCompleteBox. Once they do, query the database to get a subset of values that closer match their criteria. If they remove characters, you will need to re-query the table to change the data source values.

其次,我建议分页你自动完成的结果。在用户在AutoCompleteBox中输入两到三个字符之前,请不要进行初始查询。完成后,查询数据库以获取更接近其条件的值的子集。如果删除字符,则需要重新查询表以更改数据源值。

The key is to 1) index your table based on the string values and 2) bring back as little as possible from the server to the client so that you keep your network payload small.

关键是1)根据字符串值索引表格,2)尽可能少地从服务器返回到客户端,以便保持网络有效负载较小。