Class KEFCoreDbContextOptionsBuilder
- Namespace
- MASES.EntityFrameworkCore.KNet.Infrastructure
- Assembly
- MASES.EntityFrameworkCore.KNet.dll
Allows Kafka specific configuration to be performed on DbContextOptions.
public class KEFCoreDbContextOptionsBuilder : IKEFCoreDbContextOptionsBuilderInfrastructure
- Inheritance
-
KEFCoreDbContextOptionsBuilder
- Implements
- Inherited Members
Remarks
Instances of this class are returned from a call to UseKEFCore(DbContextOptionsBuilder, string?, string, Action<KEFCoreDbContextOptionsBuilder>?) and it is not designed to be directly constructed in your application code.
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
Constructors
KEFCoreDbContextOptionsBuilder(DbContextOptionsBuilder)
Allows Kafka specific configuration to be performed on DbContextOptions.
public KEFCoreDbContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder)
Parameters
optionsBuilderDbContextOptionsBuilderThe options builder.
Remarks
Instances of this class are returned from a call to UseKEFCore(DbContextOptionsBuilder, string?, string, Action<KEFCoreDbContextOptionsBuilder>?) and it is not designed to be directly constructed in your application code.
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
Properties
OptionsBuilder
Clones the configuration in this builder.
protected virtual DbContextOptionsBuilder OptionsBuilder { get; }
Property Value
- DbContextOptionsBuilder
The cloned configuration.
Methods
WithCompactedReplicator(bool)
Enables use of KNetCompactedReplicator<K, V>
[Obsolete("Option will be removed soon")]
public virtual KEFCoreDbContextOptionsBuilder WithCompactedReplicator(bool useCompactedReplicator = false)
Parameters
useCompactedReplicatorboolIf true then KNetCompactedReplicator<K, V> will be used instead of Apache Kafka Streams.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithConsumerConfig(ConsumerConfigBuilder)
Set properties of KNetCompactedReplicator<K, V>.
public virtual KEFCoreDbContextOptionsBuilder WithConsumerConfig(ConsumerConfigBuilder consumerConfigBuilder)
Parameters
consumerConfigBuilderConsumerConfigBuilderThe ConsumerConfigBuilder where options are stored.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithDefaultConsumerInstances(int?)
Defines the default number of consumer instances to be used in conjunction with WithCompactedReplicator(bool)
public virtual KEFCoreDbContextOptionsBuilder WithDefaultConsumerInstances(int? defaultConsumerInstances = null)
Parameters
defaultConsumerInstancesint?The default number of consumer instances to be used in conjunction with WithCompactedReplicator(bool)
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithDefaultNumPartitions(int)
Defines the default number of partitions to use when a new topic is created
public virtual KEFCoreDbContextOptionsBuilder WithDefaultNumPartitions(int defaultNumPartitions = 1)
Parameters
defaultNumPartitionsintThe default number of partitions to use when a new topic is created.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithDefaultReplicationFactor(short)
Defines the default replication factor to use when a new topic is created
public virtual KEFCoreDbContextOptionsBuilder WithDefaultReplicationFactor(short defaultReplicationFactor = 1)
Parameters
defaultReplicationFactorshortThe default replication factor to use when a new topic is created.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithDefaultSynchronizationTimeout(long)
The default timeout, expressed in milliseconds, KEFCore will wait for backend to be in-sync with Apache Kafka™ cluster.
Setting DefaultSynchronizationTimeout to 0 the synchronization will be disabled
public virtual KEFCoreDbContextOptionsBuilder WithDefaultSynchronizationTimeout(long defaultSynchronizationTimeout)
Parameters
defaultSynchronizationTimeoutlongThe default timeout, expressed in milliseconds, KEFCore will wait for backend to be in-sync with Apache Kafka™ cluster.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithKeySerDesSelectorType(Type)
Define the external serialization Type for key
public virtual KEFCoreDbContextOptionsBuilder WithKeySerDesSelectorType(Type serializationType)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithManageEvents(bool)
Setting this property to true if the engine shall reject any write operation, its value will be used to verify if topics has the proper rights WRITE and READ
public virtual KEFCoreDbContextOptionsBuilder WithManageEvents(bool manageEvents)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithProducerConfig(ProducerConfigBuilder)
Set properties of KafkaProducer.
public virtual KEFCoreDbContextOptionsBuilder WithProducerConfig(ProducerConfigBuilder producerConfigBuilder)
Parameters
producerConfigBuilderProducerConfigBuilderThe ProducerConfigBuilder where options are stored.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithReadOnlyMode(bool)
Setting this property to true the engine will emit events on ChangeTracker
public virtual KEFCoreDbContextOptionsBuilder WithReadOnlyMode(bool readOnlyMode)
Parameters
readOnlyModebooltrue to receive events from the engine on ChangeTracker
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithStoreKeyRange(bool)
Setting the value to true will enable key range look-up
public virtual KEFCoreDbContextOptionsBuilder WithStoreKeyRange(bool useStoreKeyRange)
Parameters
useStoreKeyRangeboolSet to true to enable single key range look-up in engine based Apache Kafka™ streams.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithStorePrefixScan(bool)
Setting the value to true will enable prefix scan in engine
public virtual KEFCoreDbContextOptionsBuilder WithStorePrefixScan(bool useStorePrefixScan)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithStoreReverse(bool)
Setting the value to true will enable reverse look-up
public virtual KEFCoreDbContextOptionsBuilder WithStoreReverse(bool useStoreReverse)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithStoreReverseKeyRange(bool)
Setting the value to true will enable reverse key range look-up
public virtual KEFCoreDbContextOptionsBuilder WithStoreReverseKeyRange(bool useStoreReverseKeyRange)
Parameters
useStoreReverseKeyRangeboolSet to true to enable reverse key range look-up in engine based Apache Kafka™ streams.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithStoreSingleKeyLookup(bool)
Setting the value to true will enable single key look-up
public virtual KEFCoreDbContextOptionsBuilder WithStoreSingleKeyLookup(bool useStoreSingleKeyLookup)
Parameters
useStoreSingleKeyLookupboolSet to true to enable single key look-up in engine based Apache Kafka™ streams.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithStreamsConfig(StreamsConfigBuilder)
Set properties of KafkaStreams.
public virtual KEFCoreDbContextOptionsBuilder WithStreamsConfig(StreamsConfigBuilder streamsConfigBuilder)
Parameters
streamsConfigBuilderStreamsConfigBuilderThe StreamsConfigBuilder where options are stored.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithTopicConfig(TopicConfigBuilder)
Set properties of TopicConfig.
public virtual KEFCoreDbContextOptionsBuilder WithTopicConfig(TopicConfigBuilder topicConfig)
Parameters
topicConfigTopicConfigBuilderThe TopicConfigBuilder where options are stored.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithTopicPrefix(string?)
Define the prefix to be added to the topic name deducted from the model
public virtual KEFCoreDbContextOptionsBuilder WithTopicPrefix(string? topicPrefix)
Parameters
topicPrefixstringThe prefix to be added to the topic name deducted from the model.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithUseByteBufferDataTransfer(bool)
Setting this property to true the engine prefers to use ByteBuffer data exchange in serializer instances
public virtual KEFCoreDbContextOptionsBuilder WithUseByteBufferDataTransfer(bool useByteBufferDataTransfer = true)
Parameters
useByteBufferDataTransferboolIf true, ByteBuffer data exchange will be preferred.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithUseDeletePolicyForTopic(bool)
Enables delete cleanup policy when the topic is created the first time
public virtual KEFCoreDbContextOptionsBuilder WithUseDeletePolicyForTopic(bool useDeletePolicyForTopic = false)
Parameters
useDeletePolicyForTopicboolIf true, then will be used delete cleanup policy when the topic is created the first time.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithUseEnumeratorWithPrefetch(bool)
Setting this property to true the engine prefers to use enumerator instances able to do a prefetch on data speeding up execution
public virtual KEFCoreDbContextOptionsBuilder WithUseEnumeratorWithPrefetch(bool useEnumeratorWithPrefetch = true)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Used only if UseCompactedReplicator is false and UseKNetStreams is true, not available in EFCore 6 See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithUseGlobalTable(bool)
Setting this property to true the engine based on Streams (i.e. UseCompactedReplicator is false) will use GlobalKTable<K, V> (GlobalKTable<K, V, TJVMK, TJVMV> if UseKNetStreams is true) instead of KTable<K, V> (KTable<K, V, TJVMK, TJVMV> if UseKNetStreams is true) to manage local storage of information.
public virtual KEFCoreDbContextOptionsBuilder WithUseGlobalTable(bool useGlobalTable = false)
Parameters
useGlobalTableboolIf true then GlobalKTable<K, V> (GlobalKTable<K, V, TJVMK, TJVMV> if UseKNetStreams is true.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithUseKNetStreams(bool)
Enables use of KNet version of Apache Kafka Streams
public virtual KEFCoreDbContextOptionsBuilder WithUseKNetStreams(bool useKNetStreams = false)
Parameters
useKNetStreamsboolIf true then KNet version of Apache Kafka Streams will be used instead of standard Apache Kafka Streams.
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithUsePersistentStorage(bool)
Setting this property to true the engine prefers to use enumerator instances able to do a prefetch on data speeding up execution
public virtual KEFCoreDbContextOptionsBuilder WithUsePersistentStorage(bool usePersistentStorage = false)
Parameters
usePersistentStorageboolIf true the engine prefers to use enumerator instances able to do a prefetch on data speeding up execution
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
Used only if UseCompactedReplicator is false and UseKNetStreams is true, not available in EFCore 6. See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithValueContainerType(Type)
Define the external Type which contains the values
public virtual KEFCoreDbContextOptionsBuilder WithValueContainerType(Type serializationType)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.
WithValueSerDesSelectorType(Type)
Define the external serialization Type for value
public virtual KEFCoreDbContextOptionsBuilder WithValueSerDesSelectorType(Type serializationType)
Parameters
Returns
- KEFCoreDbContextOptionsBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Using DbContextOptions, and The EF Core Kafka database provider for more information and examples.