Skip to content

Class EventTopicAttribute<TEntity>

Namespace: Momentum.Extensions.Abstractions.Messaging
Assembly: Momentum.Extensions.Abstractions.dll

Specifies the topic name for a distributed event class based on an entity type.

csharp
[AttributeUsage(AttributeTargets.Class)]
public class EventTopicAttribute<TEntity> : EventTopicAttribute

Type Parameters

TEntity

The entity type whose name will be used to generate the topic name.

Inheritance

objectAttributeEventTopicAttributeEventTopicAttribute<TEntity>

Inherited Members

EventTopicAttribute.Topic, EventTopicAttribute.Domain, EventTopicAttribute.Version, EventTopicAttribute.Internal, EventTopicAttribute.ShouldPluralizeTopicName, Attribute.GetCustomAttributes(MemberInfo, Type), Attribute.GetCustomAttributes(MemberInfo, Type, bool), Attribute.GetCustomAttributes(MemberInfo), Attribute.GetCustomAttributes(MemberInfo, bool), Attribute.IsDefined(MemberInfo, Type), Attribute.IsDefined(MemberInfo, Type, bool), Attribute.GetCustomAttribute(MemberInfo, Type), Attribute.GetCustomAttribute(MemberInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo), Attribute.GetCustomAttributes(ParameterInfo, Type), Attribute.GetCustomAttributes(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo, bool), Attribute.IsDefined(ParameterInfo, Type), Attribute.IsDefined(ParameterInfo, Type, bool), Attribute.GetCustomAttribute(ParameterInfo, Type), Attribute.GetCustomAttribute(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(Module, Type), Attribute.GetCustomAttributes(Module), Attribute.GetCustomAttributes(Module, bool), Attribute.GetCustomAttributes(Module, Type, bool), Attribute.IsDefined(Module, Type), Attribute.IsDefined(Module, Type, bool), Attribute.GetCustomAttribute(Module, Type), Attribute.GetCustomAttribute(Module, Type, bool), Attribute.GetCustomAttributes(Assembly, Type), Attribute.GetCustomAttributes(Assembly, Type, bool), Attribute.GetCustomAttributes(Assembly), Attribute.GetCustomAttributes(Assembly, bool), Attribute.IsDefined(Assembly, Type), Attribute.IsDefined(Assembly, Type, bool), Attribute.GetCustomAttribute(Assembly, Type), Attribute.GetCustomAttribute(Assembly, Type, bool), Attribute.Equals(object?), Attribute.GetHashCode(), Attribute.Match(object?), Attribute.IsDefaultAttribute(), Attribute.TypeId, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

[EventTopic<User>(domain: "identity")]
public record UserCreatedEvent(Guid Id);
// Results in topic: "users"

Remarks

This generic version automatically generates a topic name from the entity type name, converting it to kebab-case. For example, UserAccount becomes user-accounts.

Constructors

EventTopicAttribute(string?, string?, string)

Specifies the topic name for a distributed event class based on an entity type.

csharp
public EventTopicAttribute(string? domain = null, string? topic = null, string version = "v1")

Parameters

domain string?

topic string?

version string

Examples

[EventTopic<User>(domain: "identity")]
public record UserCreatedEvent(Guid Id);
// Results in topic: "users"

Remarks

This generic version automatically generates a topic name from the entity type name, converting it to kebab-case. For example, UserAccount becomes user-accounts.

Properties

ShouldPluralizeTopicName

csharp
public override bool ShouldPluralizeTopicName { get; }

Property Value

bool