Skip to content
KajayDocs
.NETSDK neutraladvanced

Connect .NET host services

Provide choices, files, validation, functions, endpoints, clocks, and cancellation through SurveyOptions.

Compose host services with SurveyOptions

SurveyOptions supplies explicit clocks, endpoint origins, expression functions, validation, remote choices, and file operations without giving Kajay network or storage authority.

SurveyHost.cscsharp
using Kajay;
using Kajay.Hosting;

var options = new SurveyOptions
{
    TimeProvider = TimeProvider.System,
    Endpoints = new Dictionary<string, string>
    {
        ["directory"] = "https://api.example.com"
    },
    ChoiceFetcher = async (request, cancellationToken) =>
    {
        // Resolve request.Url through the host's authenticated HTTP policy.
        return await LoadChoicesAsync(request, cancellationToken);
    }
};

Survey survey = await definition.CreateSurveyAsync(options, cancellationToken);

Use the asynchronous runtime path

Call CreateSurveyAsync, SetValueAsync, SettleAsync, and AdvanceAsync when configured behavior may reach a host delegate.

Propagate cancellation and failures

Every host operation receives a CancellationToken and an explicit UTC clock. Cancellation remains OperationCanceledException; contextual adapter failures use Kajay exception types.