Skip to content

Commit

Permalink
Nested Cosmos Db compatibility (#352)
Browse files Browse the repository at this point in the history
* Add RenameEmptyParameterExpressionNames configuration.

* Add ConsoleApp_netcore2.1_CosmosDb test console.

* Add ParameterExpressionHelper unit tests. CodeFactor feedback.

* More unit tests for ParameterExpressionHelper.

* Code review feedback.

* Add comment to IsNullOrWhiteSpace method to explain why we cannot use string.IsNullOrWhiteSpace.
  • Loading branch information
countincognito authored Mar 18, 2020
1 parent d7ae34d commit 553d0a3
Show file tree
Hide file tree
Showing 18 changed files with 738 additions and 9 deletions.
38 changes: 38 additions & 0 deletions System.Linq.Dynamic.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.EntityFrameworkC
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore3.1_EF3.1", "src-console\ConsoleAppEF3.1\ConsoleApp_netcore3.1_EF3.1.csproj", "{6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.1_CosmosDb", "src-console\ConsoleApp_netcore2.1_CosmosDb\ConsoleApp_netcore2.1_CosmosDb.csproj", "{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp_net452_CosmosDb", "src-console\ConsoleApp_net452_CosmosDb\ConsoleApp_net452_CosmosDb.csproj", "{0034821E-740D-4553-821B-14CE9213C43C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -439,6 +443,38 @@ Global
{6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x64.Build.0 = Release|Any CPU
{6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x86.ActiveCfg = Release|Any CPU
{6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x86.Build.0 = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|ARM.Build.0 = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x64.ActiveCfg = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x64.Build.0 = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x86.ActiveCfg = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x86.Build.0 = Debug|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|Any CPU.Build.0 = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|ARM.ActiveCfg = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|ARM.Build.0 = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x64.ActiveCfg = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x64.Build.0 = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x86.ActiveCfg = Release|Any CPU
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x86.Build.0 = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|ARM.Build.0 = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|x64.ActiveCfg = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|x64.Build.0 = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|x86.ActiveCfg = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Debug|x86.Build.0 = Debug|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|Any CPU.Build.0 = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|ARM.ActiveCfg = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|ARM.Build.0 = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|x64.ActiveCfg = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|x64.Build.0 = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|x86.ActiveCfg = Release|Any CPU
{0034821E-740D-4553-821B-14CE9213C43C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -466,6 +502,8 @@ Global
{D3804228-91F4-4502-9595-39584EA20000} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F}
{0077F262-D69B-44D2-8A7C-87D8D19022A6} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{6D21EBF2-C92D-4AE0-9BC3-47C63928F88A} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
{0034821E-740D-4553-821B-14CE9213C43C} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20}
Expand Down
6 changes: 6 additions & 0 deletions src-console/ConsoleApp_net452_CosmosDb/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0034821E-740D-4553-821B-14CE9213C43C}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConsoleAppCosmosDb</RootNamespace>
<AssemblyName>ConsoleAppCosmosDb</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>ConsoleAppCosmosDb.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Documents.Client, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entities\Entity.cs" />
<Compile Include="Entities\EntityData.cs" />
<Compile Include="Entities\EntityReading.cs" />
<Compile Include="Entities\EntityReadingValue.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\System.Linq.Dynamic.Core\System.Linq.Dynamic.Core.csproj">
<Project>{d3804228-91f4-4502-9595-39584e510002}</Project>
<Name>System.Linq.Dynamic.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Azure.DocumentDB.2.5.1\build\Microsoft.Azure.DocumentDB.targets'))" />
</Target>
</Project>
11 changes: 11 additions & 0 deletions src-console/ConsoleApp_net452_CosmosDb/Entities/Entity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace ConsoleAppCosmosDb.Entities
{
[Serializable]
public class Entity
{
public Guid Id { get; set; }
public EntityData Data { get; set; }
}
}
11 changes: 11 additions & 0 deletions src-console/ConsoleApp_net452_CosmosDb/Entities/EntityData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;

namespace ConsoleAppCosmosDb.Entities
{
[Serializable]
public class EntityData
{
public IList<EntityReading> Readings { get; set; }
}
}
12 changes: 12 additions & 0 deletions src-console/ConsoleApp_net452_CosmosDb/Entities/EntityReading.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace ConsoleAppCosmosDb.Entities
{
[Serializable]
public class EntityReading
{
public string Status { get; set; }
public int Weight { get; set; }
public EntityReadingValue Value { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace ConsoleAppCosmosDb.Entities
{
[Serializable]
public class EntityReadingValue
{
public int Weight { get; set; }
}
}
Loading

0 comments on commit 553d0a3

Please sign in to comment.