---
title: "Class ToManyRelation<TRelation>"
slug: "sdk--stylelabs.m.sdk.models.typed.fields.tomanyrelation-1"
abstract: ""
---
# Class ToManyRelation<TRelation>

Defines a relation that is associated with many entities.

## Inheritance

object

ToManyRelation<TRelation>

[ReadOnlyToManyRelation<TRelation>](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.models.typed.fields.readonlytomanyrelation-1.html)

## Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ModelsTypedFields

## Assembly: Stylelabs.M.Sdk.dll

## Syntax

```csharp
public class ToManyRelation<TRelation> where TRelation : class, IToManyRelation
```

## Type Parameters

| Name | Description |
| --- | --- |
| TRelation | The type of the relation. |

## Constructors

### ToManyRelation(IMClient, TypedEntityWrapper, string)

Initializes a new instance of the [ToManyRelation<TRelation>](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.models.typed.fields.tomanyrelation-1.html) class.

#### Declaration

```csharp
public ToManyRelation(IMClient client, TypedEntityWrapper wrapper, string relationName)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [IMClient](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.imclient.html) | client | The [IMClient](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.imclient.html) instance. |
| [TypedEntityWrapper](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.utilities.typedentitywrapper.html) | wrapper | The typed entity wrapper. |
| string | relationName | The property name. |

## Fields

### Client

The client.

#### Declaration

```csharp
protected readonly IMClient Client
```

#### Field Value

| Type | Description |
| --- | --- |
| [IMClient](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.imclient.html) |  |

### Relation

The relation.

#### Declaration

```csharp
protected readonly TRelation Relation
```

#### Field Value

| Type | Description |
| --- | --- |
| TRelation |  |

## Properties

### Ids

Gets or sets the value of the relation.

#### Declaration

```csharp
public virtual IList<long> Ids { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| IList<>long |  |

## Methods

### GetEntitiesAsync(EntityLoadConfiguration)

Gets the related entities as an [IEntity](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.ientity.html).

#### Declaration

```csharp
public Task<IList<IEntity>> GetEntitiesAsync(EntityLoadConfiguration loadConfiguration = null)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [EntityLoadConfiguration](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadconfigurations.entityloadconfiguration.html) | loadConfiguration | The [IEntityLoadConfiguration](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadconfigurations.ientityloadconfiguration.html). |

#### Returns

| Type | Description |
| --- | --- |
| Task<>IList<>[IEntity](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.ientity.html) | A list of [IEntity](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.ientity.html). |

### GetEntitiesAsync<TEntity>(EntityLoadConfiguration)

Gets the related entities as a typed [ITypedEntity](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.itypedentity.html).

#### Declaration

```csharp
public Task<IList<TEntity>> GetEntitiesAsync<TEntity>(EntityLoadConfiguration loadConfiguration = null) where TEntity : ITypedEntity
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [EntityLoadConfiguration](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadconfigurations.entityloadconfiguration.html) | loadConfiguration | The [IEntityLoadConfiguration](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadconfigurations.ientityloadconfiguration.html). |

#### Returns

| Type | Description |
| --- | --- |
| Task<>IList<> | A list of [IEntity](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.contracts.base.ientity.html). |

#### Type Parameters

| Name | Description |
| --- | --- |
| TEntity | The type of the entity. |
