Path: redb-route/redb.Route.Controllers/Attributes/BindingAttributes.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Controllers/Attributes/BindingAttributes.cs
----
namespace redb.Route.Controllers.Attributes;
/// Binds a parameter from the exchange message body (exchange.In.Body). JSON-deserialized.
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class FromBodyAttribute : Attribute { }
/// Binds a parameter from a message header (exchange.In.Headers[name]).
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class FromHeaderAttribute : Attribute
{
/// Header key name.
public string Name { get; }
/// Header key name.
public FromHeaderAttribute(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
}
/// Binds a parameter from an exchange property (exchange.Properties[name]).
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class FromPropertyAttribute : Attribute
{
/// Property key name.
public string Name { get; }
/// Property key name.
public FromPropertyAttribute(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
}
/// Binds a parameter from a query string value (exchange.In.Headers["query.{name}"]).
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class FromQueryAttribute : Attribute
{
/// Query parameter name.
public string Name { get; }
/// Query parameter name.
public FromQueryAttribute(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
}
/// Binds a parameter from a route path segment (extracted from template matching, e.g. {id}).
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class FromRouteAttribute : Attribute
{
/// Route parameter name (must match a {param} in the route template).
public string Name { get; }
/// Route parameter name.
public FromRouteAttribute(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
}