gpt4 book ai didi

c# - 在这个 ObjectSet.SelectValue 示例中, "it"来自哪里?

转载 作者:太空狗 更新时间:2023-10-29 17:49:50 25 4
gpt4 key购买 nike

productQuery1.SelectValue<Int32>("it.ProductID");

我怎么知道这里的“它”是什么意思?

整个示例来自 MSDN docs

using (AdventureWorksEntities context =
new AdventureWorksEntities())
{
string queryString =
@"SELECT VALUE product FROM
AdventureWorksEntities.Products AS product";

ObjectQuery<Product> productQuery1 =
new ObjectQuery<Product>(queryString,
context, MergeOption.NoTracking);

ObjectQuery<Int32> productQuery2 =
productQuery1.SelectValue<Int32>("it.ProductID");

foreach (Int32 result in productQuery2)
{
Console.WriteLine("{0}", result);
}
}

最佳答案

它更像是这个

It's a convention in query builder methods .

In a query builder method, you refer to the current ObjectQuery command by using an alias. By default, the string "it" is the alias that represents the current command...

关于c# - 在这个 ObjectSet<T>.SelectValue 示例中, "it"来自哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7601550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com