# StateStorageBridge&lt;TState&gt; Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.core.statestoragebridge-1/)

## ClearStateAsync {#clearstateasync-55b71e62}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.core.statestoragebridge-1/methods/clearstateasync-55b71e62/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Storage/StateStorageBridge.cs#L153-L184)

```csharp
public Task ClearStateAsync()
```

Clears the grain state.

### Returns

A `System.Threading.Tasks.Task` representing the operation.

## OnDehydrate(IDehydrationContext) {#ondehydrate-orleans-runtime-idehydrationcontext-a1f2f02f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.core.statestoragebridge-1/methods/ondehydrate-orleans-runtime-idehydrationcontext-a1f2f02f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Storage/StateStorageBridge.cs#L191-L198)

```csharp
public void OnDehydrate(IDehydrationContext dehydrationContext)
```

Called on the original activation when migration is initiated, after [IGrainBase](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.igrainbase/) completes. The participant can access and update the dehydration context.

### Parameters

- `dehydrationContext` (`IDehydrationContext`): The dehydration context.

## OnRehydrate(IRehydrationContext) {#onrehydrate-orleans-runtime-irehydrationcontext-f1919769}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.core.statestoragebridge-1/methods/onrehydrate-orleans-runtime-irehydrationcontext-f1919769/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Storage/StateStorageBridge.cs#L205-L215)

```csharp
public void OnRehydrate(IRehydrationContext rehydrationContext)
```

Called on the new activation after a migration, before [IGrainBase](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.igrainbase/) is called. The participant can restore state from the migration context.

### Parameters

- `rehydrationContext` (`IRehydrationContext`): The rehydration context.

## ReadStateAsync {#readstateasync-5cb26129}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.core.statestoragebridge-1/methods/readstateasync-5cb26129/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Storage/StateStorageBridge.cs#L85-L113)

```csharp
public Task ReadStateAsync()
```

Reads grain state from storage.

### Returns

A `System.Threading.Tasks.Task` representing the operation.

## WriteStateAsync {#writestateasync-cddbb7ac}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.core.statestoragebridge-1/methods/writestateasync-cddbb7ac/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Runtime/Storage/StateStorageBridge.cs#L120-L146)

```csharp
public Task WriteStateAsync()
```

Writes grain state to storage.

### Returns

A `System.Threading.Tasks.Task` representing the operation.
