---
title: "Class ServiceCollectionExtensions"
slug: "sitecore.aspnet.renderingengine.extensions.servicecollectionextensions"
abstract: ""
---
# Class ServiceCollectionExtensions

Extension methods for setting up Sitecore Rendering Engine related services in an Microsoft.Extensions.DependencyInjection.IServiceCollection.

## Inheritance

System.Object

ServiceCollectionExtensions

### **Namespace**: Sitecore.AspNet.RenderingEngine.Extensions

#### **Assembly**: Sitecore.AspNet.RenderingEngine.dll

##### Syntax

```csharp
public static class ServiceCollectionExtensions : Object

```

### Methods

#### AddSitecoreRenderingEngine(IServiceCollection, Action<RenderingEngineOptions>)

Adds the Sitecore Rendering Engine services to the Microsoft.Extensions.DependencyInjection.IServiceCollection.

##### Declaration

```csharp
public static ISitecoreRenderingEngineBuilder AddSitecoreRenderingEngine(this IServiceCollection services, Action<RenderingEngineOptions> options = null)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The Microsoft.Extensions.DependencyInjection.IServiceCollection to add services to. |
| System.Action<br><br><<br><br>RenderingEngineOptions<br><br>> | options | Configures the Rendering Engine options. |

##### Returns

| Type | Description |
| --- | --- |
| ISitecoreRenderingEngineBuilder | The Microsoft.Extensions.DependencyInjection.IServiceCollection so that additional calls can be chained. |

#### ForwardHeaders(ISitecoreRenderingEngineBuilder, Action<ForwardHeadersOptions>)

Enables forwarding of headers.

##### Declaration

```csharp
public static ISitecoreRenderingEngineBuilder ForwardHeaders(this ISitecoreRenderingEngineBuilder serviceBuilder, Action<ForwardHeadersOptions> options = null)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| ISitecoreRenderingEngineBuilder | serviceBuilder | The [ISitecoreRenderingEngineBuilder](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.isitecorerenderingenginebuilder.html) to add services to. |
| System.Action<br><br><<br><br>ForwardHeadersOptions<br><br>> | options | Configures the headers forwarding options. |

##### Returns

| Type | Description |
| --- | --- |
| ISitecoreRenderingEngineBuilder | The Microsoft.Extensions.DependencyInjection.IServiceCollection so that additional calls can be chained. |
