Linq查询提高性能高效查询

时间:2019-02-19 04:49:47

标签: linq

# I'm using ScrolledText for the input field
self.textBox = ScrolledText.ScrolledText(master=self.topFrame, wrap="word", bg='beige', padx=20, pady=5)

# Binding Shortcuts
rootone.bind("<Control-a>", self.selectAllOperation)

# Function Defination
def selectAllOperation(self, event=None):
        self.textBox.tag_add('sel', '1.0', 'end')

我需要提高性能。

映射产品两个表时,每个表具有多个产品

1 个答案:

答案 0 :(得分:0)

如果要提高性能,则需要了解正在发送的数据量。您的变量中有多少个“产品”。

更新您的产品列表以包含整数/引导并将其发送到数据库,而不是发送比较之前必须在数据库上运行ToUpper()的字符串,可能会更快。

类似: var conversionList = products.Select(new {TenantId = int.parse(product.TenantId),productId = Guid.Parse(x.ProductId)}

然后将其发送到您的Db,并直接进行比较

我认为将“选择1).ToList()。Sum()”更改为“ .Count()”将提高性能。即使没有,也有助于提高可读性。

相关问题