EFCore.ClickHouse 8.0.0

dotnet add package EFCore.ClickHouse --version 8.0.0
NuGet\Install-Package EFCore.ClickHouse -Version 8.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EFCore.ClickHouse" Version="8.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EFCore.ClickHouse --version 8.0.0
#r "nuget: EFCore.ClickHouse, 8.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 :

  1. HasMergeTreeEngine()
  2. HasReplacingMergeTreeEngine()
  3. HasStripeLogEngine()
  4. 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:
  1. HasOrderBy(a=> new{a.ID, a.Date})
  2. HasPartitionBy(a=> new{a.ID, a.Date})
  3. HasPrimaryKey(a=> new{a.ID, a.Date})
  4. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 1,960 11/19/2023
1.1.23 545 10/29/2023
1.1.22 107 10/29/2023
1.1.21 996 9/3/2023
1.1.20 165 9/3/2023
1.1.18 917 7/25/2023
1.1.17 155 7/24/2023
1.1.16 148 7/23/2023
1.1.8 144 7/19/2023
1.0.2 141 7/18/2023
1.0.1 129 7/18/2023
1.0.0 147 7/16/2023