# CoreHostingExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/)

## AddActivityPropagation(ISiloBuilder) {#addactivitypropagation-this-orleans-hosting-isilobuilder-b06e82a5}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/methods/addactivitypropagation-this-orleans-hosting-isilobuilder-b06e82a5/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs#L34-L38)

```csharp
public static ISiloBuilder AddActivityPropagation(this ISiloBuilder builder)
```

Add `System.Diagnostics.Activity.Current` propagation through grain calls. Note: according to `System.Diagnostics.ActivitySource.StartActivity(System.String,System.Diagnostics.ActivityKind)` activity will be created only when any listener for activity exists `System.Diagnostics.ActivitySource.HasListeners` and `System.Diagnostics.ActivityListener.Sample` returns `System.Diagnostics.ActivitySamplingResult.PropagationData`.

### Parameters

- `builder` (`ISiloBuilder`): The builder.

### Returns

The builder.

## AddDistributedGrainDirectory(ISiloBuilder, string?) {#adddistributedgraindirectory-this-orleans-hosting-isilobuilder-string-nullable-c4ebfc85}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/methods/adddistributedgraindirectory-this-orleans-hosting-isilobuilder-string-nullable-c4ebfc85/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs#L159-L179)

```csharp
[System.Diagnostics.CodeAnalysis.Experimental(ORLEANSEXP003)]
public static ISiloBuilder AddDistributedGrainDirectory(this ISiloBuilder siloBuilder, string? name = null)
```

Opts-in to the experimental distributed grain directory.

### Parameters

- `siloBuilder` (`ISiloBuilder`): The silo builder to register the directory implementation with.
- `name` (`string?`): The name of the directory to register, or null to register the directory as the default.

### Returns

The provided silo builder.

## UseDevelopmentClustering(ISiloBuilder, Action&lt;DevelopmentClusterMembershipOptions&gt;) {#usedevelopmentclustering-this-orleans-hosting-isilobuilder-system-action-orleans-fadba112}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/methods/usedevelopmentclustering-this-orleans-hosting-isilobuilder-system-action-orleans-fadba112/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs)

```csharp
public static ISiloBuilder UseDevelopmentClustering(this ISiloBuilder builder, Action<DevelopmentClusterMembershipOptions> configureOptions)
```

Configures the silo to use development-only clustering.

### Parameters

- `builder` (`ISiloBuilder`)
- `configureOptions` (`Action<DevelopmentClusterMembershipOptions>`)

## UseDevelopmentClustering(ISiloBuilder, Action&lt;OptionsBuilder&lt;DevelopmentClusterMembershipOptions&gt;&gt;) {#usedevelopmentclustering-this-orleans-hosting-isilobuilder-system-action-microso-e07cb053}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/methods/usedevelopmentclustering-this-orleans-hosting-isilobuilder-system-action-microso-e07cb053/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs)

```csharp
public static ISiloBuilder UseDevelopmentClustering(this ISiloBuilder builder, Action<OptionsBuilder<DevelopmentClusterMembershipOptions>> configureOptions)
```

Configures the silo to use development-only clustering.

### Parameters

- `builder` (`ISiloBuilder`)
- `configureOptions` (`Action<OptionsBuilder<DevelopmentClusterMembershipOptions>>`)

## UseDevelopmentClustering(ISiloBuilder, IPEndPoint) {#usedevelopmentclustering-this-orleans-hosting-isilobuilder-system-net-ipendpoint-7b7f615d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/methods/usedevelopmentclustering-this-orleans-hosting-isilobuilder-system-net-ipendpoint-7b7f615d/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs#L103)

```csharp
public static ISiloBuilder UseDevelopmentClustering(this ISiloBuilder builder, IPEndPoint primarySiloEndpoint)
```

Configures the silo to use development-only clustering.

### Parameters

- `builder` (`ISiloBuilder`)
- `primarySiloEndpoint` (`IPEndPoint`): The endpoint of the primary silo, or `null` to use this silo as the primary.

### Returns

The silo builder.

## UseLocalhostClustering(ISiloBuilder, int, int, IPEndPoint?, string, string) {#uselocalhostclustering-this-orleans-hosting-isilobuilder-int-int-system-net-ipen-b56807b8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.hosting.corehostingextensions/methods/uselocalhostclustering-this-orleans-hosting-isilobuilder-int-int-system-net-ipen-b56807b8/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs#L61-L90)

```csharp
public static ISiloBuilder UseLocalhostClustering(this ISiloBuilder builder, int siloPort = 11111, int gatewayPort = 30000, IPEndPoint? primarySiloEndpoint = null, string serviceId = "dev", string clusterId = "dev")
```

Configures the silo to use development-only clustering and listen on localhost.

### Parameters

- `builder` (`ISiloBuilder`): The silo builder.
- `siloPort` (`int`): The silo port.
- `gatewayPort` (`int`): The gateway port.
- `primarySiloEndpoint` (`IPEndPoint?`): The endpoint of the primary silo, or `null` to use this silo as the primary.
- `serviceId` (`string`): The service id.
- `clusterId` (`string`): The cluster id.

### Returns

The silo builder.
