# JournalingHostingExtensions.AddStateMachine(IServiceCollection)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalinghostingextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalinghostingextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/8bc9fd244427351ad24ccc039a9e7642a42c1cc4/src/Orleans.Journaling/JournalingHostingExtensions.cs#L77-L79)

```csharp
public static IServiceCollection AddStateMachine<TState, TImplementation>(this IServiceCollection services)
```

Registers a custom durable state contract and its state machine implementation.

### Parameters

- `services` (`IServiceCollection`): The service collection.

### Returns

The service collection.
