开发者

Where does "it" come from in this example of ObjectSet<T>.SelectValue?

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

How would I know what "it" means here?

Whole example from MSDN docs

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

    ObjectQuery<Product> productQuery1 =
        new ObjectQuery&l开发者_如何学Got;Product>(queryString,
            context, MergeOption.NoTracking);

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

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


It's more like this.

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜