Table of Contents

Class KEFCoreModelBuilderExtensions

Namespace
MASES.EntityFrameworkCore.KNet.Extensions
Assembly
MASES.EntityFrameworkCore.KNet.dll

Extension methods on ModelBuilder for Kafka-specific model configuration.

public static class KEFCoreModelBuilderExtensions
Inheritance
KEFCoreModelBuilderExtensions
Inherited Members

Methods

HasKEFCoreTopicPrefix(EntityTypeBuilder, string?)

Sets the Kafka topic prefix for this entity type, overriding the context-level prefix.

public static EntityTypeBuilder HasKEFCoreTopicPrefix(this EntityTypeBuilder entityTypeBuilder, string? prefix)

Parameters

entityTypeBuilder EntityTypeBuilder

The EntityTypeBuilder to configure.

prefix string

The topic prefix, or null to disable prefixing for this entity.

Returns

EntityTypeBuilder

The same EntityTypeBuilder for chaining.

ToKEFCoreTopic(EntityTypeBuilder, string)

Sets the Kafka topic name for this entity type, overriding the default naming convention.

public static EntityTypeBuilder ToKEFCoreTopic(this EntityTypeBuilder entityTypeBuilder, string topicName)

Parameters

entityTypeBuilder EntityTypeBuilder

The EntityTypeBuilder to configure.

topicName string

The Kafka topic name.

Returns

EntityTypeBuilder

The same EntityTypeBuilder for chaining.

Remarks

Equivalent to applying KEFCoreTopicAttribute on the entity class. Takes precedence over TableAttribute and the entity type name.

UseKEFCoreManageEvents(ModelBuilder, bool)

Sets the default KEFCore event management behavior for all entity types in the model.

public static ModelBuilder UseKEFCoreManageEvents(this ModelBuilder modelBuilder, bool manageEvents = true)

Parameters

modelBuilder ModelBuilder

The ModelBuilder to configure.

manageEvents bool

true to enable event management for all entities (default); false to disable it globally.

Returns

ModelBuilder

The same ModelBuilder for chaining.

Remarks

Individual entities can override this via KEFCoreIgnoreEventsAttribute or HasKEFCoreManageEvents(EntityTypeBuilder, bool). Event management is enabled by default — call this method with false to disable it globally.

UseKEFCoreTopicPrefix(ModelBuilder, string?)

Sets a global Kafka topic prefix for all entity types in the model.

public static ModelBuilder UseKEFCoreTopicPrefix(this ModelBuilder modelBuilder, string? prefix)

Parameters

modelBuilder ModelBuilder

The ModelBuilder to configure.

prefix string

The topic prefix, or null to disable prefixing.

Returns

ModelBuilder

The same ModelBuilder for chaining.

Remarks

The prefix is stored as a model annotation (TopicPrefix) and consumed by KEFCoreTopicNamingConvention during model building.

Per-entity overrides are still possible via KEFCoreTopicPrefixAttribute applied directly to the entity class.

Passing null explicitly disables prefixing for all entities that do not have a KEFCoreTopicPrefixAttribute.