Skip to content

Commit

Permalink
Merge pull request #48 from MikeAmputer/kravtsov/parameters-in-body
Browse files Browse the repository at this point in the history
Send parameters in body
  • Loading branch information
MikeAmputer authored Jul 19, 2024
2 parents 4eb94b3 + 4a5444e commit a32970c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ClickHouse.Facades/ClickHouse.Facades.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClickHouse.Client" Version="7.5.3" />
<PackageReference Include="ClickHouse.Client" Version="7.6.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>

Expand Down
2 changes: 2 additions & 0 deletions src/ClickHouse.Facades/Context/Context/ClickHouseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ internal async Task Initialize(ClickHouseContextOptions<TContext> options)

_connection = CreateConnection(options);

_connection.SetFormDataParameters(options.ParametersInBody);

_connectionBroker = options.ConnectionBrokerProvider(
_connection,
ICommandExecutionStrategy.Pick(options.CommandExecutionStrategy));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ internal Func<ClickHouseConnection, ICommandExecutionStrategy, IClickHouseConnec
internal CommandExecutionStrategy CommandExecutionStrategy { get; set; } = CommandExecutionStrategy.Default;

internal TransactionBrokerOptions TransactionBrokerOptions { get; set; } = null!;

internal bool ParametersInBody { get; set; } = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ private OptionalValue<

private OptionalValue<Action<TransactionBrokerOptionsBuilder>> _setupTransactionBrokerOptions;

private OptionalValue<bool> _parametersInBody;

public ClickHouseContextOptionsBuilder<TContext> SetupTransactions(
Action<TransactionBrokerOptionsBuilder> setup)
{
Expand Down Expand Up @@ -135,6 +137,14 @@ internal ClickHouseContextOptionsBuilder<TContext> WithConnectionBrokerProvider(
connectionBrokerProvider);
}

public ClickHouseContextOptionsBuilder<TContext> SendParametersInBody()
{
return WithPropertyValue(
builder => builder._parametersInBody,
(builder, value) => builder._parametersInBody = value,
true);
}

protected override ClickHouseContextOptions<TContext> BuildCore()
{
var connectionString = _connectionString.NotNullOrThrow();
Expand All @@ -160,6 +170,7 @@ protected override ClickHouseContextOptions<TContext> BuildCore()
ConnectionBrokerProvider = _connectionBrokerProvider.NotNullOrThrow(),
CommandExecutionStrategy = _commandExecutionStrategy.OrElseValue(CommandExecutionStrategy.Default),
TransactionBrokerOptions = transactionBrokerOptions,
ParametersInBody = _parametersInBody.OrDefault(),
};
}

Expand Down

0 comments on commit a32970c

Please sign in to comment.