Class KEFCoreEntityTypeExtensions
- Namespace
- MASES.EntityFrameworkCore.KNet.Extensions
- Assembly
- MASES.EntityFrameworkCore.KNet.dll
Extension methods for IReadOnlyEntityType for the Kafka provider.
public static class KEFCoreEntityTypeExtensions
- Inheritance
-
KEFCoreEntityTypeExtensions
- Inherited Members
Remarks
See Modeling entity types and relationships, and The EF Core Kafka database provider for more information and examples.
Methods
ApplicationIdForTable(IEntityType, KEFCoreOptionsExtension)
Creates the application id
public static string ApplicationIdForTable(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
BuildProducerConfig(IEntityType, KEFCoreOptionsExtension)
Builds the ProducerConfigBuilder for this entity type, merging the global ProducerConfig with any per-entity overrides stored as a KEFCoreProducerAnnotation annotation. Per-entity values take precedence over the global config.
public static ProducerConfigBuilder BuildProducerConfig(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
BuildTopicConfig(IEntityType, KEFCoreOptionsExtension)
Builds the TopicConfigBuilder for this entity type, merging the global TopicConfig with any per-entity retention overrides set via KEFCoreTopicRetentionAttribute or HasKEFCoreTopicRetention(EntityTypeBuilder, long, long). Per-entity values take precedence over the global config.
public static TopicConfigBuilder BuildTopicConfig(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
- TopicConfigBuilder
A TopicConfigBuilder ready to pass to CreateTopic(string, int, short, Map<String, String>, IDiagnosticsLogger<Infrastructure>) via ToMap().
ConsumerInstances(IEntityType, KEFCoreOptionsExtension)
Gets consumer instances
[Obsolete("Option will be removed soon")]
public static int? ConsumerInstances(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
- int?
GetKEFCoreTopicName(IEntityType)
Creates the topic name
public static string GetKEFCoreTopicName(this IEntityType entityType)
Parameters
entityTypeIEntityType
Returns
GetKeySerDesSelectorType(IEntityType, IKEFCoreSingletonOptions)
Returns the key serializer selector type for this entity type. Reads KeySerDesSelectorType annotation first, falling back to KeySerDesSelectorType.
public static Type? GetKeySerDesSelectorType(this IEntityType entityType, IKEFCoreSingletonOptions options)
Parameters
entityTypeIEntityTypeoptionsIKEFCoreSingletonOptions
Returns
GetManageEvents(IEntityType)
Returns whether KEFCore event management is enabled for this entity type. Reads the ManageEvents annotation set by KEFCoreManageEventsConvention.
public static bool GetManageEvents(this IEntityType entityType)
Parameters
entityTypeIEntityTypeThe IEntityType to query.
Returns
- bool
true if event management is enabled (default); false if disabled via KEFCoreIgnoreEventsAttribute or
HasKEFCoreManageEvents(false).
GetReadOnly(IEntityType, KEFCoreOptionsExtension)
Returns whether this entity type is read-only. Returns true if KEFCoreReadOnlyAttribute is applied or if the context-level ReadOnlyMode is enabled.
public static bool GetReadOnly(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
GetTopicRetentionBytes(IEntityType)
Returns the per-entity topic retention in bytes, or null if not set. When null, the global TopicConfig applies.
public static long? GetTopicRetentionBytes(this IEntityType entityType)
Parameters
entityTypeIEntityType
Returns
- long?
GetTopicRetentionMs(IEntityType)
Returns the per-entity topic retention in milliseconds, or null if not set. When null, the global TopicConfig applies.
public static long? GetTopicRetentionMs(this IEntityType entityType)
Parameters
entityTypeIEntityType
Returns
- long?
GetTransactionGroup(IEntityType)
Returns the Kafka transaction group for this entity type, or null if the entity does not participate in a Kafka transaction.
public static string? GetTransactionGroup(this IEntityType entityType)
Parameters
entityTypeIEntityType
Returns
GetUseStoreKeyRange(IEntityType, KEFCoreOptionsExtension)
Returns whether key range look-up optimization is enabled for this entity type. Reads UseStoreKeyRange annotation first, falling back to UseStoreKeyRange.
public static bool GetUseStoreKeyRange(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
GetUseStorePrefixScan(IEntityType, KEFCoreOptionsExtension)
Returns whether prefix scan optimization is enabled for this entity type. Reads UseStorePrefixScan annotation first, falling back to UseStorePrefixScan.
public static bool GetUseStorePrefixScan(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
GetUseStoreReverse(IEntityType, KEFCoreOptionsExtension)
Returns whether reverse iteration optimization is enabled for this entity type. Reads UseStoreReverse annotation first, falling back to UseStoreReverse.
public static bool GetUseStoreReverse(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
GetUseStoreReverseKeyRange(IEntityType, KEFCoreOptionsExtension)
Returns whether reverse key range look-up optimization is enabled for this entity type. Reads UseStoreReverseKeyRange annotation first, falling back to UseStoreReverseKeyRange.
public static bool GetUseStoreReverseKeyRange(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
GetUseStoreSingleKeyLookup(IEntityType, KEFCoreOptionsExtension)
Returns whether single key look-up optimization is enabled for this entity type. Reads UseStoreSingleKeyLookup annotation first, falling back to UseStoreSingleKeyLookup.
public static bool GetUseStoreSingleKeyLookup(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
GetValueContainerType(IEntityType, IKEFCoreSingletonOptions)
Returns the value container type for this entity type. Reads ValueContainerType annotation first, falling back to ValueContainerType.
public static Type? GetValueContainerType(this IEntityType entityType, IKEFCoreSingletonOptions options)
Parameters
entityTypeIEntityTypeoptionsIKEFCoreSingletonOptions
Returns
GetValueSerDesSelectorType(IEntityType, IKEFCoreSingletonOptions)
Returns the value container serializer selector type for this entity type. Reads ValueSerDesSelectorType annotation first, falling back to ValueSerDesSelectorType.
public static Type? GetValueSerDesSelectorType(this IEntityType entityType, IKEFCoreSingletonOptions options)
Parameters
entityTypeIEntityTypeoptionsIKEFCoreSingletonOptions
Returns
NumPartitions(IEntityType, KEFCoreOptionsExtension)
Returns the number of partitions for the Kafka topic associated with this entity type. Reads NumPartitions annotation first, falling back to DefaultNumPartitions.
public static int NumPartitions(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
ReplicationFactor(IEntityType, KEFCoreOptionsExtension)
Returns the replication factor for the Kafka topic associated with this entity type. Reads ReplicationFactor annotation first, falling back to DefaultReplicationFactor.
public static short ReplicationFactor(this IEntityType entityType, KEFCoreOptionsExtension options)
Parameters
entityTypeIEntityTypeoptionsKEFCoreOptionsExtension
Returns
StorageIdForTable(IEntityType)
Creates the storage id
public static string StorageIdForTable(this IEntityType entityType)
Parameters
entityTypeIEntityType