using System;
namespace ZeroLevel.Network
{
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public abstract class ExchangeAttribute : Attribute { }
///
/// Marks the method that is the default message handler
///
public sealed class ExchangeMainHandlerAttribute : ExchangeAttribute { }
///
/// Marks the method that is the default message handler
///
public sealed class ExchangeMainReplierAttribute : ExchangeAttribute { }
///
/// Marks a message handler method for an inbox with the specified name.
///
public sealed class ExchangeHandlerAttribute : ExchangeAttribute
{
public string Inbox { get; }
public ExchangeHandlerAttribute(string inbox)
{
this.Inbox = inbox;
}
}
///
/// Marks a message handler method for an inbox with the specified name.
///
public sealed class ExchangeReplierAttribute : ExchangeAttribute
{
public string Inbox { get; }
public ExchangeReplierAttribute(string inbox)
{
this.Inbox = inbox;
}
}
///
/// Marks a message handler method for an inbox with the specified name.
///
public sealed class ExchangeMainReplierWithoutArgAttribute : ExchangeAttribute { }
///
/// Marks a message handler method for an inbox with the specified name.
///
public sealed class ExchangeReplierWithoutArgAttribute : ExchangeAttribute
{
public string Inbox { get; }
public ExchangeReplierWithoutArgAttribute(string inbox)
{
this.Inbox = inbox;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public class ExchangeServerAttribute : Attribute
{
public string Protocol { get; }
public ExchangeServerAttribute(string protocol)
{
if (string.IsNullOrWhiteSpace(protocol)) throw new ArgumentNullException(nameof(protocol));
this.Protocol = protocol;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public class ExchangeClientAttribute : Attribute
{
public string Protocol { get; }
public ExchangeClientAttribute(string protocol)
{
if (string.IsNullOrWhiteSpace(protocol)) throw new ArgumentNullException(nameof(protocol));
this.Protocol = protocol;
}
}
}