EFCore.ClickHouse
8.0.0
dotnet add package EFCore.ClickHouse --version 8.0.0
NuGet\Install-Package EFCore.ClickHouse -Version 8.0.0
<PackageReference Include="EFCore.ClickHouse" Version="8.0.0" />
paket add EFCore.ClickHouse --version 8.0.0
#r "nuget: EFCore.ClickHouse, 8.0.0"
// Install EFCore.ClickHouse as a Cake Addin #addin nuget:?package=EFCore.ClickHouse&version=8.0.0 // Install EFCore.ClickHouse as a Cake Tool #tool nuget:?package=EFCore.ClickHouse&version=8.0.0
ClickHouse provider for Entity Framework Core
Support Migrations.
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 | net8.0 is compatible. 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. |
-
net8.0
- ClickHouse.Client (>= 6.8.1)
- Microsoft.EntityFrameworkCore (>= 8.0.0)
- Microsoft.EntityFrameworkCore.Abstractions (>= 8.0.0)
- Microsoft.EntityFrameworkCore.Design (>= 8.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.