# OrleansServiceExtensions Methods

- Package: [Aspire.Hosting.Orleans](/reference/api/csharp/aspire.hosting.orleans.md)
- Type: [OrleansServiceExtensions](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions.md)
- Kind: `Methods`
- Members: `26`

Extensions to `Hosting.IDistributedApplicationBuilder` related to Orleans.

## AddOrleans(IDistributedApplicationBuilder, string)

- Name: `AddOrleans(IDistributedApplicationBuilder, string)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L30)

Adds an Orleans service to the application.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService AddOrleans(
        this IDistributedApplicationBuilder builder,
        string name)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The application builder.
- `name` (`string`)
  The name of the Orleans service.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## AsClient(OrleansService)

- Name: `AsClient(OrleansService)`
- Modifiers: `extension`
- Returns: [OrleansServiceClient](/reference/api/csharp/aspire.hosting.orleans/orleansserviceclient.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L370)

Returns a model of the clients of an Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansServiceClient AsClient(
        this OrleansService orleansService)
    {
        // ...
    }
}
```

## Parameters

- `orleansService` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The Orleans service

## Returns

[OrleansServiceClient](/reference/api/csharp/aspire.hosting.orleans/orleansserviceclient.md) -- A model of the clients of an Orleans service.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithBroadcastChannel(OrleansService, string, IProviderConfiguration)

- Name: `WithBroadcastChannel(OrleansService, string, IProviderConfiguration)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L260-L261)

Adds a broadcast channel provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithBroadcastChannel(
        this OrleansService orleansServiceBuilder,
        string name,
        IProviderConfiguration provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` ([IProviderConfiguration](/reference/api/csharp/aspire.hosting.orleans/iproviderconfiguration.md))
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithBroadcastChannel(OrleansService, string, IProviderConfiguration)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withbroadcastchannel-orleansservice-string-iproviderconfiguration) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithBroadcastChannel(OrleansService, string)

- Name: `WithBroadcastChannel(OrleansService, string)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L274)

Adds a broadcast channel provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithBroadcastChannel(
        this OrleansService orleansServiceBuilder,
        string name)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithClusterId(OrleansService, string)

- Name: `WithClusterId(OrleansService, string)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Sets the ClusterId of the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithClusterId(
        this OrleansService orleansServiceBuilder,
        string clusterId)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `clusterId` (`string`)
  The ClusterId value.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithClusterId(OrleansService, IResourceBuilder<ParameterResource>)

- Name: `WithClusterId(OrleansService, IResourceBuilder<ParameterResource>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Sets the ClusterId of the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithClusterId(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<ParameterResource> clusterId)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `clusterId` (`IResourceBuilder<ParameterResource>`)
  The ClusterId value.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithClusterId(OrleansService, string)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withclusterid-orleansservice-string) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithClustering(OrleansService, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithClustering(OrleansService, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Configures the Orleans service to use the provided clustering provider.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithClustering(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithClustering(OrleansService, IProviderConfiguration)

- Name: `WithClustering(OrleansService, IProviderConfiguration)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Configures the Orleans service to use the provided clustering provider.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithClustering(
        this OrleansService orleansServiceBuilder,
        IProviderConfiguration provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` ([IProviderConfiguration](/reference/api/csharp/aspire.hosting.orleans/iproviderconfiguration.md))
  The provider.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithClustering(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withclustering-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithDevelopmentClustering(OrleansService)

- Name: `WithDevelopmentClustering(OrleansService)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L130)

Configures the Orleans service to use development-only clustering.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithDevelopmentClustering(
        this OrleansService orleansServiceBuilder)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithGrainDirectory(OrleansService, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithGrainDirectory(OrleansService, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L328)

Adds a grain directory provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithGrainDirectory(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This resource name is the name the application will use to resolve the provider. This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithGrainDirectory(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withgraindirectory-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithGrainDirectory(OrleansService, string, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithGrainDirectory(OrleansService, string, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Adds a grain directory provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithGrainDirectory(
        this OrleansService orleansServiceBuilder,
        string name,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithGrainDirectory(OrleansService, string, IProviderConfiguration)

- Name: `WithGrainDirectory(OrleansService, string, IProviderConfiguration)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Adds a grain directory provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithGrainDirectory(
        this OrleansService orleansServiceBuilder,
        string name,
        IProviderConfiguration provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` ([IProviderConfiguration](/reference/api/csharp/aspire.hosting.orleans/iproviderconfiguration.md))
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithGrainDirectory(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withgraindirectory-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithGrainStorage(OrleansService, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithGrainStorage(OrleansService, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L143)

Adds a grain storage provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithGrainStorage(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This resource name is the name the application will use to resolve the provider. This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithGrainStorage(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withgrainstorage-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithGrainStorage(OrleansService, string, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithGrainStorage(OrleansService, string, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Adds a grain storage provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithGrainStorage(
        this OrleansService orleansServiceBuilder,
        string name,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithGrainStorage(OrleansService, string, IProviderConfiguration)

- Name: `WithGrainStorage(OrleansService, string, IProviderConfiguration)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Adds a grain storage provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithGrainStorage(
        this OrleansService orleansServiceBuilder,
        string name,
        IProviderConfiguration provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` ([IProviderConfiguration](/reference/api/csharp/aspire.hosting.orleans/iproviderconfiguration.md))
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithGrainStorage(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withgrainstorage-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithMemoryGrainStorage(OrleansService, string)

- Name: `WithMemoryGrainStorage(OrleansService, string)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L187)

Adds an in-memory grain storage to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithMemoryGrainStorage(
        this OrleansService orleansServiceBuilder,
        string name)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithMemoryReminders(OrleansService)

- Name: `WithMemoryReminders(OrleansService)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L313-L314)

Configures in-memory reminder storage for the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithMemoryReminders(
        this OrleansService orleansServiceBuilder)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithMemoryStreaming(OrleansService, string)

- Name: `WithMemoryStreaming(OrleansService, string)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L244)

Adds an in-memory stream provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithMemoryStreaming(
        this OrleansService orleansServiceBuilder,
        string name)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithReference(IResourceBuilder<T>, OrleansService)

- Name: `WithReference(IResourceBuilder<T>, OrleansService)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<T>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L386)

Adds Orleans to the resource.

```csharp
public static class OrleansServiceExtensions
{
    public static IResourceBuilder<T> WithReference<T>(
        this IResourceBuilder<T> builder,
        OrleansService orleansService)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<T>`)
  The builder on which add the Orleans service builder.
- `orleansService` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The Orleans service, containing clustering, etc.

## Returns

`IResourceBuilder<T>` -- The resource builder.

## Exceptions

- `InvalidOperationException` -- Clustering has not been configured.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithReminders(OrleansService, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithReminders(OrleansService, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Configures reminder storage for the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithReminders(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The reminder storage provider.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithReminders(OrleansService, IProviderConfiguration)

- Name: `WithReminders(OrleansService, IProviderConfiguration)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Configures reminder storage for the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithReminders(
        this OrleansService orleansServiceBuilder,
        IProviderConfiguration provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` ([IProviderConfiguration](/reference/api/csharp/aspire.hosting.orleans/iproviderconfiguration.md))
  The reminder storage provider to use.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithReminders(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withreminders-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithServiceId(OrleansService, string)

- Name: `WithServiceId(OrleansService, string)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Sets the ServiceId of the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithServiceId(
        this OrleansService orleansServiceBuilder,
        string serviceId)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `serviceId` (`string`)
  The ServiceId value.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithServiceId(OrleansService, IResourceBuilder<ParameterResource>)

- Name: `WithServiceId(OrleansService, IResourceBuilder<ParameterResource>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Sets the ServiceId of the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithServiceId(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<ParameterResource> serviceId)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `serviceId` (`IResourceBuilder<ParameterResource>`)
  The ServiceId value.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithServiceId(OrleansService, string)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withserviceid-orleansservice-string) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithStreaming(OrleansService, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithStreaming(OrleansService, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs#L200)

Adds a stream provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithStreaming(
        this OrleansService orleansServiceBuilder,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This resource name is the name the application will use to resolve the provider. This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithStreaming(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withstreaming-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithStreaming(OrleansService, string, IResourceBuilder<IResourceWithConnectionString>)

- Name: `WithStreaming(OrleansService, string, IResourceBuilder<IResourceWithConnectionString>)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Adds a stream provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithStreaming(
        this OrleansService orleansServiceBuilder,
        string name,
        IResourceBuilder<IResourceWithConnectionString> provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` (`IResourceBuilder<IResourceWithConnectionString>`)
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithStreaming(OrleansService, string, IProviderConfiguration)

- Name: `WithStreaming(OrleansService, string, IProviderConfiguration)`
- Modifiers: `extension`
- Returns: [OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Orleans/OrleansServiceExtensions.cs)

Adds a stream provider to the Orleans service.

```csharp
public static class OrleansServiceExtensions
{
    public static OrleansService WithStreaming(
        this OrleansService orleansServiceBuilder,
        string name,
        IProviderConfiguration provider)
    {
        // ...
    }
}
```

## Parameters

- `orleansServiceBuilder` ([OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md))
  The target Orleans service builder.
- `name` (`string`)
  The name of the provider. This is the name the application will use to resolve the provider.
- `provider` ([IProviderConfiguration](/reference/api/csharp/aspire.hosting.orleans/iproviderconfiguration.md))
  The provider to add.

## Returns

[OrleansService](/reference/api/csharp/aspire.hosting.orleans/orleansservice.md) -- The Orleans service builder.

## Remarks

This method is not available in polyglot app hosts. Use [OrleansServiceExtensions.WithStreaming(OrleansService, IResourceBuilder<IResourceWithConnectionString>)](/reference/api/csharp/aspire.hosting.orleans/orleansserviceextensions/methods.md#withstreaming-orleansservice-iresourcebuilder-iresourcewithconnectionstring) instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.
