Skip to content

Commit ddfec24

Browse files
committed
add LINQ aggregates
1 parent 3d7c155 commit ddfec24

22 files changed

+73
-43
lines changed

samples/code-samples/ChangeFeed/ChangeFeed.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
</PropertyGroup>
3737
<ItemGroup>
3838
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
39-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
39+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
40+
<Private>True</Private>
4041
</Reference>
4142
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
4243
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -71,12 +72,12 @@
7172
</ProjectReference>
7273
</ItemGroup>
7374
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
74-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" />
75+
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" />
7576
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
7677
<PropertyGroup>
7778
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
7879
</PropertyGroup>
79-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets'))" />
80+
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets'))" />
8081
</Target>
8182
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8283
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.DocumentDB" version="1.12.0" targetFramework="net452" />
3+
<package id="Microsoft.Azure.DocumentDB" version="1.12.1" targetFramework="net452" />
44
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
55
</packages>

samples/code-samples/CollectionManagement/CollectionManagement.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
</PropertyGroup>
4646
<ItemGroup>
4747
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
48+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
49+
<Private>True</Private>
4950
</Reference>
5051
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5152
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -76,12 +77,12 @@
7677
<Folder Include="Properties\" />
7778
</ItemGroup>
7879
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
79-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" />
80+
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" />
8081
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
8182
<PropertyGroup>
8283
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
8384
</PropertyGroup>
84-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets'))" />
85+
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets'))" />
8586
</Target>
8687
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8788
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.DocumentDB" version="1.12.0" targetFramework="net451" />
4-
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
3+
<package id="Microsoft.Azure.DocumentDB" version="1.12.1" targetFramework="net451" />
4+
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
55
</packages>

samples/code-samples/DatabaseManagement/DatabaseManagement.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
</PropertyGroup>
4646
<ItemGroup>
4747
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
48+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
49+
<Private>True</Private>
4950
</Reference>
5051
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5152
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -78,12 +79,12 @@
7879
<Folder Include="Properties\" />
7980
</ItemGroup>
8081
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
81-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" />
82+
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" />
8283
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
8384
<PropertyGroup>
8485
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
8586
</PropertyGroup>
86-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets'))" />
87+
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets'))" />
8788
</Target>
8889
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8990
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.DocumentDB" version="1.12.0" targetFramework="net451" />
3+
<package id="Microsoft.Azure.DocumentDB" version="1.12.1" targetFramework="net451" />
44
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
55
</packages>

samples/code-samples/DocumentManagement/DocumentManagement.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
</PropertyGroup>
4646
<ItemGroup>
4747
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
48+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
49+
<Private>True</Private>
4950
</Reference>
5051
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5152
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -81,12 +82,12 @@
8182
<Folder Include="Properties\" />
8283
</ItemGroup>
8384
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
84-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" />
85+
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" />
8586
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
8687
<PropertyGroup>
8788
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
8889
</PropertyGroup>
89-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets'))" />
90+
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets'))" />
9091
</Target>
9192
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
9293
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.DocumentDB" version="1.12.0" targetFramework="net451" />
3+
<package id="Microsoft.Azure.DocumentDB" version="1.12.1" targetFramework="net451" />
44
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
55
</packages>

samples/code-samples/Geospatial/Geospatial.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
</PropertyGroup>
4646
<ItemGroup>
4747
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
48+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
49+
<Private>True</Private>
4950
</Reference>
5051
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5152
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -81,12 +82,12 @@
8182
</ProjectReference>
8283
</ItemGroup>
8384
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
84-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" />
85+
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" />
8586
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
8687
<PropertyGroup>
8788
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
8889
</PropertyGroup>
89-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets'))" />
90+
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets'))" />
9091
</Target>
9192
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
9293
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.DocumentDB" version="1.12.0" targetFramework="net451" />
3+
<package id="Microsoft.Azure.DocumentDB" version="1.12.1" targetFramework="net451" />
44
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
55
</packages>

samples/code-samples/IndexManagement/IndexManagement.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
</PropertyGroup>
4646
<ItemGroup>
4747
<Reference Include="Microsoft.Azure.Documents.Client, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.0\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
48+
<HintPath>..\packages\Microsoft.Azure.DocumentDB.1.12.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
49+
<Private>True</Private>
4950
</Reference>
5051
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5152
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -79,12 +80,12 @@
7980
</ProjectReference>
8081
</ItemGroup>
8182
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
82-
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" />
83+
<Import Project="..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" />
8384
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
8485
<PropertyGroup>
8586
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
8687
</PropertyGroup>
87-
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.0\build\Microsoft.Azure.DocumentDB.targets'))" />
88+
<Error Condition="!Exists('..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Azure.DocumentDB.1.12.1\build\Microsoft.Azure.DocumentDB.targets'))" />
8889
</Target>
8990
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
9091
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.DocumentDB" version="1.12.0" targetFramework="net451" />
3+
<package id="Microsoft.Azure.DocumentDB" version="1.12.1" targetFramework="net451" />
44
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
55
</packages>

samples/code-samples/Queries/Program.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,13 @@ private static void QueryWithAggregates(Uri collectionUri)
456456

457457
Assert("Expected only 1 family", count == 1);
458458

459+
// LINQ
460+
count = client.CreateDocumentQuery<Family>(collectionUri, DefaultOptions)
461+
.Where(f => f.LastName == "Andersen")
462+
.Count();
463+
464+
Assert("Expected only 1 family", count == 1);
465+
459466
// SQL over an array within documents
460467
count = client.CreateDocumentQuery<int>(
461468
collectionUri,
@@ -465,6 +472,13 @@ private static void QueryWithAggregates(Uri collectionUri)
465472

466473
Assert("Expected 3 children", count == 3);
467474

475+
// LINQ
476+
count = client.CreateDocumentQuery<Family>(collectionUri, DefaultOptions)
477+
.SelectMany(f => f.Children)
478+
.Count();
479+
480+
Assert("Expected 3 children", count == 3);
481+
468482
// SQL over an array within documents
469483
int maxGrade = client.CreateDocumentQuery<int>(
470484
collectionUri,
@@ -473,6 +487,12 @@ private static void QueryWithAggregates(Uri collectionUri)
473487
.AsEnumerable().First();
474488

475489
Assert("Expected 8th grade", maxGrade == 8);
490+
491+
maxGrade = client.CreateDocumentQuery<Family>(collectionUri, DefaultOptions)
492+
.SelectMany(f => f.Children)
493+
.Max(c => c.Grade);
494+
495+
Assert("Expected 8th grade", maxGrade == 8);
476496
}
477497

478498
private static void QueryWithSubdocuments(Uri collectionUri)

0 commit comments

Comments
 (0)