Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo4jClient" Version="4.0.0" />
<PackageReference Include="Neo4jClient" Version="[4.1.26,5.1.1)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Neo4jClient.Extension.Cypher.Attributes;
using Newtonsoft.Json.Serialization;

Expand Down Expand Up @@ -86,7 +83,7 @@
return cypher;
}

internal static string ToCypherString<TEntity, TAttr>(this TEntity entity, ICypherExtensionContext context, string paramKey = null, List<CypherProperty> useProperties = null)

Check warning on line 86 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.CqlBuilders.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 86 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.CqlBuilders.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 86 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.CqlBuilders.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 86 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.CqlBuilders.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.
where TAttr : CypherExtensionAttribute
where TEntity : class
{
Expand All @@ -96,14 +93,27 @@
}
internal static string ApplyCasing(this string value, ICypherExtensionContext context)
{
var useCamelCase = (context.JsonContractResolver is CamelCasePropertyNamesContractResolver);
if (useCamelCase)
// Use the contract resolver to determine the JSON property name
if (context.JsonContractResolver != null)
{
return string.Format(
"{0}{1}"
, value.Substring(0, 1).ToLowerInvariant()
, value.Length > 1 ? value.Substring(1, value.Length - 1) : string.Empty);
// Use DefaultContractResolver's NamingStrategy if available (Newtonsoft.Json 9.0+)
if (context.JsonContractResolver is DefaultContractResolver defaultResolver &&
defaultResolver.NamingStrategy != null)
{
return defaultResolver.NamingStrategy.GetPropertyName(value, false);
}

// For CamelCasePropertyNamesContractResolver (legacy support)
if (context.JsonContractResolver is CamelCasePropertyNamesContractResolver)
{
return string.Format(
"{0}{1}",
value.Substring(0, 1).ToLowerInvariant(),
value.Length > 1 ? value.Substring(1, value.Length - 1) : string.Empty);
}
}

// Fallback to PascalCase if no resolver is configured
return value;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Neo4jClient.Extension.Cypher
{
Expand All @@ -11,7 +9,7 @@
private static Dictionary<string, object> CreateDynamic<TEntity>(
this TEntity entity
, List<CypherProperty> properties
, CreateDynamicOptions options = null) where TEntity : class

Check warning on line 12 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.Dynamics.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 12 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.Dynamics.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.
{
if (options == null)
{
Expand All @@ -36,7 +34,7 @@
return propertiesForDict.ToDictionary(x => x.Key, x => x.Value);
}

private static object GetValue<TEntity>(TEntity entity, CypherProperty property, Type entityTypeCache = null)

Check warning on line 37 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.Dynamics.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 37 in src/Neo4jClient.Extension/Cypher/Extension/CypherExtension.Dynamics.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.
{
var entityType = entityTypeCache ?? entity.GetType();
var value = entityType.GetProperty(property.TypeName).GetValue(entity, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Neo4jClient.Extension.Cypher.Attributes;

namespace Neo4jClient.Extension.Cypher
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Neo4jClient.Extension.Cypher
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text.RegularExpressions;
using Neo4jClient.Cypher;
using Neo4jClient.Extension.Cypher.Attributes;
using Newtonsoft.Json.Serialization;

namespace Neo4jClient.Extension.Cypher
{
Expand Down
5 changes: 0 additions & 5 deletions src/Neo4jClient.Extension/Cypher/FluentConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using Neo4jClient.Extension.Cypher.Attributes;

namespace Neo4jClient.Extension.Cypher
Expand All @@ -21,12 +16,12 @@
_context = context;
}

public static FluentConfig Config(CypherExtensionContext context = null)

Check warning on line 19 in src/Neo4jClient.Extension/Cypher/FluentConfig.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 19 in src/Neo4jClient.Extension/Cypher/FluentConfig.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.
{
return new FluentConfig(context??new CypherExtensionContext());
}

public ConfigWith<T> With<T>(string label = null)

Check warning on line 24 in src/Neo4jClient.Extension/Cypher/FluentConfig.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.

Check warning on line 24 in src/Neo4jClient.Extension/Cypher/FluentConfig.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Cannot convert null literal to non-nullable reference type.
{
return new ConfigWith<T>(_context, label);
}
Expand Down
6 changes: 1 addition & 5 deletions src/Neo4jClient.Extension/Cypher/MergeOptions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Neo4jClient.Extension.Cypher
{
Expand Down
2 changes: 1 addition & 1 deletion src/Neo4jClient.Extension/Neo4jClient.Extension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo4jClient" Version="4.0.0" />
<PackageReference Include="Neo4jClient" Version="[4.1.26,5.1.1)" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 1 addition & 5 deletions src/Neo4jClient.Extension/Options/CreateOptions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Neo4jClient.Extension.Cypher
{
Expand Down
8 changes: 1 addition & 7 deletions src/Neo4jClient.Extension/Options/IOptions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Neo4jClient.Extension.Cypher
namespace Neo4jClient.Extension.Cypher
{
public interface IOptionsBase
{
Expand Down
6 changes: 1 addition & 5 deletions src/Neo4jClient.Extension/Options/MatchOptions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Neo4jClient.Extension.Cypher
{
Expand Down
9 changes: 4 additions & 5 deletions test/Neo4jClient.Extension.IntegrationTest/IntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Neo4jClient.Cypher;
using Neo4jClient.Extension.Test.CustomConverters;
using Neo4jClient.Extension.Test.Data;
using Neo4jClient.Transactions;
using Newtonsoft.Json.Serialization;
using NUnit.Framework;

namespace Neo4jClient.Extension.Test.Integration
Expand Down Expand Up @@ -38,9 +35,11 @@ static IntegrationTest()
var connectionString = ConfigurationManager.AppSettings["Neo4jConnectionString"] ?? "bolt://localhost:7687";
var username = ConfigurationManager.AppSettings["Neo4jUsername"] ?? "neo4j";
var password = ConfigurationManager.AppSettings["Neo4jPassword"] ?? "testpassword";

GraphClient = new BoltGraphClient(new Uri(connectionString), username, password);

// Use CamelCasePropertyNamesContractResolver for consistent property naming
GraphClient.JsonContractResolver = new CamelCasePropertyNamesContractResolver();
GraphClient.JsonConverters.Add(new AreaJsonConverter());

((BoltGraphClient)GraphClient).ConnectAsync().Wait();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo4jClient" Version="4.0.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="FluentAssertions" Version="8.7.1" />
<PackageReference Include="Neo4jClient" Version="[4.1.26,5.1.1)" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="UnitsNet" Version="5.75.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Neo4jClient.Extension.Cypher;
using System.Threading.Tasks;
using Neo4jClient.Extension.Test.Cypher;
using NUnit.Framework;

Expand Down
Loading
Loading