![]() |
VOOZH | about |
dotnet add package MASES.EntityFrameworkCore.KNet --version 4.0.0
NuGet\Install-Package MASES.EntityFrameworkCore.KNet -Version 4.0.0
<PackageReference Include="MASES.EntityFrameworkCore.KNet" Version="4.0.0" />
<PackageVersion Include="MASES.EntityFrameworkCore.KNet" Version="4.0.0" />Directory.Packages.props
<PackageReference Include="MASES.EntityFrameworkCore.KNet" />Project file
paket add MASES.EntityFrameworkCore.KNet --version 4.0.0
#r "nuget: MASES.EntityFrameworkCore.KNet, 4.0.0"
#:package MASES.EntityFrameworkCore.KNet@4.0.0
#addin nuget:?package=MASES.EntityFrameworkCore.KNet&version=4.0.0Install as a Cake Addin
#tool nuget:?package=MASES.EntityFrameworkCore.KNet&version=4.0.0Install as a Cake Tool
To use Entity Framework Core provider for Apache Kafka™ you must have at least:
Entity Framework Core provider for Apache Kafka™ uses the official Apache Kafka™ Java client packages directly through KNet client-side features. All examples in this page use standard Producer, Consumer, and Admin Client APIs, which communicate with the broker exclusively through the Kafka wire protocol.
This means the code shown here works with any broker that implements the Kafka wire protocol — not only Apache Kafka™ itself. Examples of compatible brokers: Redpanda, Amazon MSK, Confluent Platform / Cloud, Aiven for Apache Kafka™, IBM Event Streams, WarpStream, AutoMQ, and others.
See for the full compatibility matrix covering all KNet feature areas.
dotnet new console
dotnet add package MASES.EntityFrameworkCore.KNet
using MASES.EntityFrameworkCore.KNet.Infrastructure;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace MASES.EntityFrameworkCore.KNet.Test
{
class Program
{
static void Main(string[] args)
{
KEFCore.CreateGlobalInstance();
using var context = new BloggingContext()
{
BootstrapServers = "MY-KAFKA-BROKER:9092",
ApplicationId = "MyAppId", // mandatory — must be unique per process on the cluster
DbName = "MyDBName",
};
// add standard EFCore queries
}
}
public class BloggingContext : KEFCoreDbContext { }
// [Table] stabilizes the Kafka topic name across namespace refactorings.
// Without it the topic name includes the full CLR namespace.
[Table("Blog", Schema = "Blogging")]
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
public int Rating { get; set; }
public List<Post> Posts { get; set; }
}
[Table("Post", Schema = "Blogging")]
public class Post
{
public int PostId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public int BlogId { get; set; }
public Blog Blog { get; set; }
}
}
The previous code follows the example of https://learn.microsoft.com/ef/core/. See and to find more information.
The example above connects to the broker without authentication or encryption. For production environments, KEFCore supports TLS and SASL via WithSecurityProtocol(), WithSslConfig(), and WithSaslConfig(). See for details.
Always apply [Table] or [KEFCoreTopicAttribute] to your entity classes. Without them, the Kafka topic name is derived from the full CLR type name including namespace — a namespace refactoring will silently change the topic name and break alignment with existing data in the cluster. See for details.
dotnet build
KEFCore shall initialize the environment before any operation can be done. The initialization is done executing the following command at first stages of your application:
KEFCore.CreateGlobalInstance();
The previous command identify the JVM™ and start it, loads the needed libraries and setup the environment. Browsing the repository within the test folder there are some examples. KEFCore accepts many command-line switches to customize its behavior, the full list is available at Command line switch of KNet.
One of the most important command-line switch is JVMPath and it is available in JCOBridge switches: it can be used to set-up the location of the JVM™ library if JCOBridge is not able to identify a suitable JRE/JDK installation. If a developer is using KEFCore within its own product it is possible to override the JVMPath property with a snippet like the following one:
class MyKEFCore : KEFCore
{
public override string JVMPath
{
get
{
string pathToJVM = "Set here the path to JVM library or use your own search method";
return pathToJVM;
}
}
}
IMPORTANT NOTE: pathToJVM shall be escaped
string pathToJVM = "C:\\Program Files\\Eclipse Adoptium\\jdk-11.0.18.10-hotspot\\bin\\server\\jvm.dll";string pathToJVM = @"C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot\bin\server\jvm.dll";JCOBridge try to identify a suitable JRE/JDK installation within the system using some standard mechanism of JRE/JDK: JAVA_HOME environment variable or Windows registry if available.
However it is possible, on Windows operating systems, that the library raises an InvalidOperationException: Missing Java Key in registry: Couldn't find Java installed on the machine.
This means that neither JAVA_HOME nor Windows registry contains information about a default installed JRE/JDK: some vendors may not setup them.
If the developer/user encounter this condition can do the following steps:
set | findstr JAVA_HOME and verify the result;JAVA_HOME environment variable is not set at system level, but at a different level like user level which is not visible from the KEFCore process that raised the exception;JAVA_HOME at system level e.g. JAVA_HOME=C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot\;JCOBRIDGE_JVMPath at system level e.g. JCOBRIDGE_JVMPath=C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot\.IMPORTANT NOTES:
JCOBRIDGE_JVMPath or JAVA_HOME environment variables or Windows registry (on Windows OSes) shall be availableJCOBRIDGE_JVMPath environment variable takes precedence over JAVA_HOME and Windows registry: you can set JCOBRIDGE_JVMPath to C:\Program Files\Eclipse Adoptium\jdk-11.0.18.10-hotspot\bin\server\jvm.dll and avoid to override JVMPath in your codeJVMPath takes precedence over JCOBRIDGE_JVMPath/JAVA_HOME environment variables or Windows registry| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 61 | 6/17/2026 |
| 3.0.0 | 63 | 6/17/2026 |
| 3.0.0-rc4 | 5,319 | 6/10/2026 |
| 3.0.0-rc3 | 153 | 5/26/2026 |
| 3.0.0-rc2 | 102 | 5/24/2026 |
| 3.0.0-rc1 | 117 | 5/9/2026 |
| 3.0.0-rc | 360 | 3/28/2026 |
| 3.0.0-beta | 97,386 | 3/20/2026 |
| 3.0.0-alpha4 | 159 | 3/14/2026 |
| 3.0.0-alpha3 | 151 | 3/11/2026 |
| 3.0.0-alpha2 | 112 | 3/10/2026 |
| 3.0.0-alpha1 | 106 | 3/9/2026 |
| 3.0.0-alpha | 110 | 3/2/2026 |
| 2.6.7 | 127,478 | 2/24/2026 |
| 2.6.6 | 199 | 2/13/2026 |
| 2.6.5 | 92,200 | 12/8/2025 |
| 2.6.4 | 80,394 | 9/24/2025 |
| 2.6.3 | 31,158 | 9/23/2025 |
| 2.6.2 | 20,926 | 8/8/2025 |
| 2.6.1 | 21,884 | 7/21/2025 |