Skip to content

Commit

Permalink
Adds Bolt Support
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Skardon committed Jan 22, 2018
1 parent a4d2bd1 commit 9f74ca9
Show file tree
Hide file tree
Showing 228 changed files with 30,662 additions and 6,638 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -14,4 +14,7 @@ packages
*.ghostdoc.xml
project.lock.json
msbuild.log
TestResult.xml
TestResult.xml
[Nn][Dd]epend[Ou]ut\*
\.vs/
\.idea/
46 changes: 46 additions & 0 deletions Neo4jClient.Full/BoltGraphClient.cs
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Neo4jClient.Execution;
using Neo4jClient.Serialization;
using Neo4jClient.Transactions;
using Newtonsoft.Json;

//TODO: Logging
//TODO: Config Stuff
//TODO: Transaction Stuff

namespace Neo4jClient
{
public partial class BoltGraphClient : IBoltGraphClient, IRawGraphClient, ITransactionalGraphClient
{
public BoltGraphClient(Uri uri, string username = null, string password = null, string realm = null)
{
if ((uri.Scheme == "http") || (uri.Scheme == "https"))
throw new NotSupportedException($"To use the {nameof(BoltGraphClient)} you need to provide a 'bolt://' scheme, not '{uri.Scheme}'.");

this.uri = uri;
this.username = username;
this.password = password;
this.realm = realm;
PolicyFactory = new ExecutionPolicyFactory(this);

JsonConverters = new List<JsonConverter>();
JsonConverters.AddRange(DefaultJsonConverters);
JsonContractResolver = DefaultJsonContractResolver;

ExecutionConfiguration = new ExecutionConfiguration
{
UserAgent = $"Neo4jClient/{GetType().GetTypeInfo().Assembly.GetName().Version}",
UseJsonStreaming = true,
JsonConverters = JsonConverters,
Username = username,
Password = password,
Realm = realm
};

transactionManager = new BoltTransactionManager(this);
}
}
}
3 changes: 2 additions & 1 deletion Neo4jClient.Full/Execution/CypherExecutionPolicy.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using Neo4jClient.ApiModels.Cypher;
using Neo4jClient.Cypher;
using Neo4jClient.Transactions;
Expand All @@ -16,7 +17,7 @@ internal partial class CypherExecutionPolicy : GraphClientBasedExecutionPolicy
private INeo4jTransaction GetTransactionInScope()
{
// first try to get the Non DTC transaction and if it doesn't succeed then try it with the DTC
var transactionalClient = Client as IInternalTransactionalGraphClient;
var transactionalClient = Client as IInternalTransactionalGraphClient<HttpResponseMessage>;
if (transactionalClient == null)
{
return null;
Expand Down
4 changes: 3 additions & 1 deletion Neo4jClient.Full/GraphClient.cs
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Neo4jClient.ApiModels;
using Neo4jClient.Cypher;
Expand All @@ -9,7 +10,7 @@

namespace Neo4jClient
{
public partial class GraphClient : IRawGraphClient, IInternalTransactionalGraphClient, IDisposable
public partial class GraphClient : IRawGraphClient, IInternalTransactionalGraphClient<HttpResponseMessage>, IDisposable
{
public GraphClient(Uri rootUri, string username = null, string password = null)
: this(rootUri, new HttpClientWrapper(username, password))
Expand Down Expand Up @@ -53,6 +54,7 @@ public virtual async Task ConnectAsync(NeoServerConfiguration configuration = nu
RootUri,
ExecutionConfiguration.Username,
ExecutionConfiguration.Password,
ExecutionConfiguration.Realm,
ExecutionConfiguration).ConfigureAwait(false);

RootApiResponse = configuration.ApiConfig;
Expand Down
242 changes: 127 additions & 115 deletions Neo4jClient.Full/Neo4jClient.Full.csproj
@@ -1,122 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{343B9889-6DDF-4474-A1EC-05508A652E5A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Neo4jClient</RootNamespace>
<AssemblyName>Neo4jClient</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Full - Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Full - Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Portable - Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Portable - Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Execution\CypherExecutionPolicy.cs" />
<Compile Include="Execution\GraphClientBasedExecutionPolicy.cs" />
<Compile Include="GraphClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Transactions\ClosedTransactionException.cs" />
<Compile Include="Transactions\Neo4jTransaction.cs" />
<Compile Include="Transactions\Neo4jTransactionProxy.cs" />
<Compile Include="Transactions\Neo4jTransactionResourceManager.cs" />
<Compile Include="Transactions\SuppressTransactionProxy.cs" />
<Compile Include="Transactions\TransactionConnectionContext.cs" />
<Compile Include="Transactions\TransactionContext.cs" />
<Compile Include="Transactions\TransactionExecutionEnvironment.cs" />
<Compile Include="Transactions\TransactionManager.cs" />
<Compile Include="Transactions\TransactionScopeProxy.cs" />
<Compile Include="Transactions\TransactionSinglePhaseNotification.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="..\Neo4jClient.Shared\Neo4jClient.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{343B9889-6DDF-4474-A1EC-05508A652E5A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Neo4jClient</RootNamespace>
<AssemblyName>Neo4jClient</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Full - Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Full - Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Portable - Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Portable - Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Neo4jClient.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Neo4j.Driver, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Neo4j.Driver.1.5.0\lib\net452\Neo4j.Driver.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.2\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Transactions" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="BoltGraphClient.cs" />
<Compile Include="Execution\CypherExecutionPolicy.cs" />
<Compile Include="Execution\GraphClientBasedExecutionPolicy.cs" />
<Compile Include="GraphClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Transactions\Bolt\BoltNeo4jTransactionProxy.cs" />
<Compile Include="Transactions\Bolt\BoltSuppressTransactionProxy.cs" />
<Compile Include="Transactions\Bolt\BoltTransactionPromotableSinglePhasesNotification.cs" />
<Compile Include="Transactions\ClosedTransactionException.cs" />
<Compile Include="Transactions\BoltNeo4jTransaction.cs" />
<Compile Include="Transactions\Neo4jRestTransaction.cs" />
<Compile Include="Transactions\Neo4jTransactionProxy.cs" />
<Compile Include="Transactions\Neo4jTransactionResourceManager.cs" />
<Compile Include="Transactions\SuppressTransactionProxy.cs" />
<Compile Include="Transactions\TransactionConnectionContext.cs" />
<Compile Include="Transactions\Bolt\BoltTransactionContext.cs" />
<Compile Include="Transactions\TransactionContext.cs" />
<Compile Include="Transactions\TransactionExecutionEnvironment.cs" />
<Compile Include="Transactions\Bolt\BoltTransactionManager.cs" />
<Compile Include="Transactions\TransactionManager.cs" />
<Compile Include="Transactions\Bolt\BoltTransactionScopeProxy.cs" />
<Compile Include="Transactions\TransactionScopeProxy.cs" />
<Compile Include="Transactions\TransactionSinglePhaseNotification.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.9.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" />
<Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.9.0\analyzers\dotnet\Microsoft.DependencyValidation.Analyzers.dll" />
</ItemGroup>
<Import Project="..\Neo4jClient.Shared\Neo4jClient.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\NETStandard.Library.2.0.0\build\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.0\build\NETStandard.Library.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\NETStandard.Library.2.0.0\build\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.0\build\NETStandard.Library.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>
2 changes: 1 addition & 1 deletion Neo4jClient.Full/Neo4jClient.Full.csproj.DotSettings
@@ -1,2 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp60</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp70</s:String></wpf:ResourceDictionary>
9 changes: 9 additions & 0 deletions Neo4jClient.Full/Neo4jClient.Full.v3.ncrunchproject
@@ -0,0 +1,9 @@
<ProjectConfiguration>
<Settings>
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

0 comments on commit 9f74ca9

Please sign in to comment.