Path: redb-route/redb.Route/Expressions/BeanCallSite.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/Expressions/BeanCallSite.cs
----
using System.Runtime.CompilerServices;
using redb.Route.Abstractions;
using redb.Route.Components.Bean;
namespace redb.Route.Expressions;
///
/// One bean:name.Method(args) call in a compiled expression. The expression is compiled once and shared by every
/// context that evaluates it, so the bean is resolved per route context: from that context's registry, on the first
/// evaluation there, with the method bound once through (the selection and
/// conversion rules of the bean: URI). A weak table keeps no context alive.
///
/// Synchronous only, as in Apache Camel's Simple language: an expression has no await, so a method returning a task
/// is refused when it is first resolved, pointing to the bean step. Refused under : a
/// template's data never runs code.
///
///
internal sealed class BeanCallSite(string reference, string method, int argumentCount)
{
private readonly ConditionalWeakTable _resolved = new();
private sealed record Resolved(object Instance, BeanInvoker.BoundMethod Bound, bool Awaitable,
Func? TaskResult, Func