在这个ObjectSet <t> .SelectValue?</t>的例子中,“它”来自何处

时间:2011-09-29 18:09:01

标签: c# entity-framework linq-to-entities

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);
    }
}

1 个答案:

答案 0 :(得分:9)

更像this

It's a convention in query builder methods

  

在查询构建器方法中,您可以使用别名来引用当前的ObjectQuery命令。默认情况下,字符串“it”是表示当前命令的别名...