EntityFrameworkCore.ClickHouse
EntityFrameworkCore.ClickHouse copied to clipboard
A very long value in a string. Invalid URI: The Uri string is too long.
class MyTable
{
public string Txt => "a very very long value .........";
}
var item = new MyTable();
var _dbSet = _dbContext.Set<MyTable>();
await _dbSet.AddAsync(item);
await _dbContext.SaveChangesAsync();
when I use EntityFramework, and I try to insert an object into the table that has a string type property and this property has a very long value, then I get this error:
exception.InnerException.Message => Invalid URI: The Uri string is too long.
exception.InnerException.StackTrace =>
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions) at System.Uri..ctor(String uriString, UriKind uriKind) at System.Net.Http.HttpRequestMessage..ctor(HttpMethod method, String requestUri) at ClickHouse.Client.ADO.ClickHouseCommand.<PostSqlQueryAsync>d__54.MoveNext() at ClickHouse.Client.ADO.ClickHouseCommand.<ExecuteDbDataReaderAsync>d__53.MoveNext() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.<ExecuteReaderAsync>d__19.MoveNext() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.<ExecuteReaderAsync>d__19.MoveNext() at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__50.MoveNext()
but, if you use this method, then everything works out successfully:
using var bulkCopy = new ClickHouseBulkCopy(connection)
{
DestinationTableName = "mytable",
BatchSize = 1
};
var list = (new List<object[]>() { new object[] { item.Txt } });
await bulkCopy.WriteToServerAsync(list);
as I understand it, this method generates the following query:
INSERT INTO {DestinationTableName} ({string.Join(", ", columnNames)}) FORMAT RowBinary;
is there a way to execute a query using ORM?
Please, try a new version EntityFrameworkCore.ClickHouse/0.0.14 and if it's still reproducible provide a minimum working example.