Path: redb-route/redb.Route/Abstractions/IConditionSource.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/Abstractions/IConditionSource.cs
----
namespace redb.Route.Abstractions;
///
/// Declarative capture of the condition a scope was built from, for definitions whose behaviour is
/// driven by a condition: Filter and the When branch of a Choice.
///
/// The DSL offers three ways to write a condition, and this contract keeps one name and one fixed
/// type for each of them, so a reader never has to guess what a property holds:
///
///
/// -
///
/// — the condition was written as a predicate instance,
/// or was compiled from a condition string into one.
///
/// -
///
/// — the condition was written as an expression
/// instance.
///
/// -
///
/// — the condition string exactly as the author wrote it.
///
///
///
///
/// A condition written as a plain delegate leaves all three null: a lambda has no source to
/// capture. A condition written as a string sets and, since it is
/// compiled into one, .
///
///
/// Only reading is offered. The properties are filled while the route is being built and are not
/// meant to be rewritten afterwards.
///
///
public interface IConditionSource
{
/// The predicate the condition was built from, or built into; null if there is none.
IPredicate? SourcePredicate { get; }
/// The expression instance the condition was built from; null if there is none.
IExpression? SourceExpression { get; }
/// The condition string as the author wrote it; null if the condition was not written as a string.
string? SourceTemplate { get; }
}