EFCore.ClickHouse
1.1.20
See the version list below for details.
dotnet add package EFCore.ClickHouse --version 1.1.20
NuGet\Install-Package EFCore.ClickHouse -Version 1.1.20
<PackageReference Include="EFCore.ClickHouse" Version="1.1.20" />
paket add EFCore.ClickHouse --version 1.1.20
#r "nuget: EFCore.ClickHouse, 1.1.20"
// Install EFCore.ClickHouse as a Cake Addin #addin nuget:?package=EFCore.ClickHouse&version=1.1.20 // Install EFCore.ClickHouse as a Cake Tool #tool nuget:?package=EFCore.ClickHouse&version=1.1.20
ClickHouse provider for Entity Framework Core
All schemas will set to null on model creating, if you want to use Schemas (which will consider as Database prefix in clickhouse) you need to set them manually after base.OnModelCreating()
add, drop and rename column not supported by some table engine type, so the only way is to recreate them, u need to use .HasCreateStrategy(TableCreationStrategy.CREATE_OR_REPLACE) FluentApi on the entityBuilder.
to specify engine type you can use these methods in onModelCreating :
- HasMergeTreeEngine()
- HasReplacingMergeTreeEngine()
- HasStripeLogEngine()
- HasPostGresEngine()
like this:
var user = modelBuilder.Entity<User>();
user.HasPostGresEngine("User", "Accounting");
- if you dont provide any argument for HasPostGresEngine(), it will invoke GetTableName() and GetSchema() to map.
- To apply basic options for merge tree falmily use these:
- HasOrderBy(a=> new{a.ID, a.Date})
- HasPartitionBy(a=> new{a.ID, a.Date})
- HasPrimaryKey(a=> new{a.ID, a.Date})
- HasSampleBy(a=> new{a.ID, a.Date})
you can set partitioning expression as string as well. and if you partition by a date/datetime column you can use PartitionByDateFormat enum to further config it:
HasPartitionBy(a=> a.Date,PartitionByDateFormat.Month)
which is :
toYYYYMM(Date)
you can chain them as well.
- to Configure advance setting for merge tree family you can use this:
user.HasMergeTreeEngine(a => { a.Settings = new(); a.Settings.MergeMaxBlockSize = 2048; a.Settings.IndexGranularityBytes = 1024; a.Settings.MinRowsForWidePart = 512; });
to configure entity types dynamically you can use these extension methods:
`var entityTypes = modelBuilder.Model.GetEntityTypes();` `foreach (var entityType in entityTypes)` `{` ` entityType.HasCreateStrategy(TableCreationStrategy.CREATE);` ` entityType.HasPostGresEngine();` `}`
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- ClickHouse.Client (>= 6.7.4)
- Microsoft.EntityFrameworkCore (>= 7.0.9)
- Microsoft.EntityFrameworkCore.Abstractions (>= 7.0.9)
- Microsoft.EntityFrameworkCore.Design (>= 7.0.9)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.