예제 #1
0
 public void TakeAndOfType()
 {
     CheckQuery(
         () => Cooks.Take(1).OfType <Chef>(),
         "SELECT TOP (1) [t0].[ID],[t0].[FirstName],[t0].[Name],[t0].[IsStarredCook],[t0].[IsFullTimeCook],[t0].[SubstitutedID],[t0].[KitchenID],"
         + "[t0].[KnifeID],[t0].[KnifeClassID] "
         + "FROM [CookTable] AS [t0] WHERE ([t0].[IsStarredCook] = 1)");
 }
예제 #2
0
 public void TakeAndCast()
 {
     CheckQuery(
         () => Cooks.Take(1).Cast <object>(),
         "SELECT TOP (1) [t0].[ID],[t0].[FirstName],[t0].[Name],[t0].[IsStarredCook],[t0].[IsFullTimeCook],[t0].[SubstitutedID],[t0].[KitchenID],"
         + "[t0].[KnifeID],[t0].[KnifeClassID] "
         + "FROM [CookTable] AS [t0]");
 }
예제 #3
0
        public void TakeAndContains()
        {
            Cook cook = new Cook {
                ID = 5, FirstName = "Hugo", Name = "Hanser"
            };

            CheckQuery(
                () => Cooks.Take(1).Contains(cook),
                "SELECT CONVERT(BIT, CASE WHEN @1 IN (SELECT TOP (1) [t0].[ID] FROM [CookTable] AS [t0]) THEN 1 ELSE 0 END) AS [value]",
                new CommandParameter("@1", cook.ID));
        }
예제 #4
0
 public void GroupBy_AfterTake()
 {
     CheckQuery(
         Cooks.Take(10).GroupBy(c => c.Kitchen.ID).Select(g => g.Key),
         "SELECT [q1].[key] AS [value] "
         + "FROM (SELECT [q0].[KitchenID] AS [key] "
         + "FROM (SELECT TOP (10) [t2].[ID],[t2].[FirstName],[t2].[Name],[t2].[IsStarredCook],[t2].[IsFullTimeCook],[t2].[SubstitutedID],"
         + "[t2].[KitchenID],[t2].[KnifeID],[t2].[KnifeClassID] "
         + "FROM [CookTable] AS [t2]) AS [q0] "
         + "GROUP BY [q0].[KitchenID]) AS [q1]");
 }