# RadiusRecipeParameterExtensions Methods

- Package: [Aspire.Hosting.Radius](/reference/api/csharp/aspire.hosting.radius.md)
- Type: [RadiusRecipeParameterExtensions](/reference/api/csharp/aspire.hosting.radius/radiusrecipeparameterextensions.md)
- Kind: `Methods`
- Members: `2`

Recipe-parameter configuration entry points for [RadiusEnvironmentResource](/reference/api/csharp/aspire.hosting.radius/radiusenvironmentresource.md). These extensions attach a recipe-parameter annotation to the environment that the publisher consumes to emit a `parameters` block on each recipe entry under `Radius.Core/recipePacks` (and the legacy `Applications.Core/environments` inline-recipes shape).

<a id="withrecipeparameters"></a>
<a id="withrecipeparameters-iresourcebuilder-radiusenvironmentresource-action-idictionary-string-object"></a>

## WithRecipeParameters(IResourceBuilder<RadiusEnvironmentResource>, Action<IDictionary<string, object>>)

- Name: `WithRecipeParameters(IResourceBuilder<RadiusEnvironmentResource>, Action<IDictionary<string, object>>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<RadiusEnvironmentResource>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Radius/Recipes/RadiusRecipeParameterExtensions.cs#L69-L77)

Declares recipe parameters applied to every recipe entry in the environment's recipe pack.

```csharp
public static class RadiusRecipeParameterExtensions
{
    public static IResourceBuilder<RadiusEnvironmentResource> WithRecipeParameters(
        this IResourceBuilder<RadiusEnvironmentResource> builder,
        Action<IDictionary<string, object>> configure)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<RadiusEnvironmentResource>`)
  The Radius environment resource builder.
- `configure` (`Action<IDictionary<string, object>>`)
  Callback that populates the environment-wide parameter set. Repeated calls merge, with the later call winning per key.

## Returns

`IResourceBuilder<RadiusEnvironmentResource>` -- The same builder for chaining.

## Exceptions

- `ArgumentException` -- A parameter key is empty or whitespace.

## Remarks

Environment-wide parameters apply to every recipe entry in the environment's recipe pack. A parameter scoped to a specific resource type via [RadiusRecipeParameterExtensions.WithRecipeParameters(IResourceBuilder<RadiusEnvironmentResource>, Action<IDictionary<string, object>>)](/reference/api/csharp/aspire.hosting.radius/radiusrecipeparameterextensions/methods.md#withrecipeparameters-iresourcebuilder-radiusenvironmentresource-action-idictionary-string-object) overrides an environment-wide parameter of the same key for entries of that type.

## Examples

Apply an environment-wide recipe parameter and a provider reference:

```csharp
var builder = DistributedApplication.CreateBuilder(args);
builder.AddRadiusEnvironment("radius")
       .WithRecipeParameters(p =>
       {
           p["tier"] = "standard";
           p["region"] = RadiusProviderReference.AwsRegion;
       });
```

## ATS metadata

### Ignored by ATS

- Reason: The configure callback over a mutable dictionary is not representable in the ATS catalog (ASPIREEXPORT008).

<a id="withrecipeparameters-iresourcebuilder-radiusenvironmentresource-string-action-idictionary-string-object"></a>

## WithRecipeParameters(IResourceBuilder<RadiusEnvironmentResource>, string, Action<IDictionary<string, object>>)

- Name: `WithRecipeParameters(IResourceBuilder<RadiusEnvironmentResource>, string, Action<IDictionary<string, object>>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<RadiusEnvironmentResource>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Radius/Recipes/RadiusRecipeParameterExtensions.cs#L102-L117)

Declares recipe parameters applied only to recipe entries of the given Radius resource type (e.g. `Radius.Data/redisCaches`). These take precedence over environment-wide parameters of the same key for that type.

```csharp
public static class RadiusRecipeParameterExtensions
{
    public static IResourceBuilder<RadiusEnvironmentResource> WithRecipeParameters(
        this IResourceBuilder<RadiusEnvironmentResource> builder,
        string resourceType,
        Action<IDictionary<string, object>> configure)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<RadiusEnvironmentResource>`)
  The Radius environment resource builder.
- `resourceType` (`string`)
  The Radius resource type to scope the parameters to.
- `configure` (`Action<IDictionary<string, object>>`)
  Callback that populates the resource-type-scoped parameter set. Repeated calls for the same type merge, with the later call winning per key.

## Returns

`IResourceBuilder<RadiusEnvironmentResource>` -- The same builder for chaining.

## Exceptions

- `ArgumentException` -- `resourceType` is empty/whitespace, or a parameter key is empty or whitespace.

## ATS metadata

### Ignored by ATS

- Reason: The configure callback over a mutable dictionary is not representable in the ATS catalog (ASPIREEXPORT008).
