Skip to content

Class DefaultDomainAttribute ​

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

Specifies the default domain for distributed events in an assembly.

csharp
[AttributeUsage(AttributeTargets.Assembly)]
public class DefaultDomainAttribute : Attribute

Inheritance ​

object ← Attribute ← DefaultDomainAttribute

Inherited Members ​

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 ​

[assembly: DefaultDomain("AppDomain")]

Remarks ​

Apply this attribute at the assembly level to define a default domain name that will be used as a fallback for distributed events that do not specify their own domain via .

Topic name resolution follows this precedence:

<ol><li><xref href="Momentum.Extensions.Abstractions.Messaging.EventTopicAttribute.Domain" data-throw-if-not-resolved="false"></xref> on the event class (if non-empty)</li><li><xref href="Momentum.Extensions.Abstractions.Messaging.DefaultDomainAttribute.Domain" data-throw-if-not-resolved="false"></xref> from this assembly-level attribute</li><li>First segment of the assembly name (e.g., <code>AppDomain.Contracts</code> → <code>AppDomain</code>)</li></ol>

Use <xref href="Momentum.Extensions.Abstractions.Messaging.DefaultDomainAttribute.GetDomainName(System.Reflection.Assembly)" data-throw-if-not-resolved="false"></xref> to resolve the effective domain for an assembly
following this precedence chain.

Constructors ​

DefaultDomainAttribute(string) ​

Initializes a new instance of the class with the specified domain name.

csharp
public DefaultDomainAttribute(string domain = "")

Parameters ​

domain string

The default domain name for distributed events.

Properties ​

Domain ​

Gets or sets the default domain name for distributed events.

csharp
public string Domain { get; set; }

Property Value ​

string

Methods ​

GetDomainName(Assembly) ​

Resolves the effective domain name for the given assembly.

csharp
public static string GetDomainName(Assembly assembly)

Parameters ​

assembly Assembly

The assembly to resolve the domain for.

Returns ​

string

The value from the assembly's if present; otherwise, the first segment of the assembly name (e.g., AppDomain.Contracts → AppDomain).