---
title: "Class RelationSpecification"
slug: "sdk--stylelabs.m.framework.essentials.loadoptions.relationspecification"
abstract: ""
---
# Class RelationSpecification

Specifies a relation.

## Inheritance

object

RelationSpecification

## Implements

[IRelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.irelationspecification.html)

## Namespace: StylelabsStylelabs.MStylelabs.M.FrameworkStylelabs.M.Framework.EssentialsLoadOptions

## Assembly: Stylelabs.M.Sdk.dll

## Syntax

```csharp
public class RelationSpecification : IRelationSpecification
```

## Constructors

### RelationSpecification()

Initializes a new instance of the [RelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.relationspecification.html) class.

#### Declaration

```csharp
public RelationSpecification()
```

### RelationSpecification(IRelationSpecification)

Initializes a new instance of the [RelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.relationspecification.html) class.

#### Declaration

```csharp
public RelationSpecification(IRelationSpecification spec)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [IRelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.irelationspecification.html) | spec | Relation specification. |

### RelationSpecification(string, RelationRole?)

Initializes a new instance of the [RelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.relationspecification.html) class with a specified `name` and optional `role`.

#### Declaration

```csharp
public RelationSpecification(string name, RelationRole? role = null)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | name | The relation name. |
| [RelationRole](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.relationrole.html) | role | The relation role. |

## Properties

### Name

Gets name of the relation (case insensitive).

#### Declaration

```csharp
public string Name { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| string |  |

### [Role](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.resources.base.role.html)

Gets if the relation is self-referencing, which role to load. If it is null, both will be loaded into two separate relation objects.

#### Declaration

```csharp
public RelationRole? Role { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| [RelationRole](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.relationrole.html) |  |

## Methods

### DeepClone()

Creates a deep clone of this instance.

#### Declaration

```csharp
public IRelationSpecification DeepClone()
```

#### Returns

| Type | Description |
| --- | --- |
| [IRelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.irelationspecification.html) | The relation specification. |

### Equals(object)

#### Declaration

```csharp
public override bool Equals(object obj)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| object | obj |  |

#### Returns

| Type | Description |
| --- | --- |
| bool |  |

### GetHashCode()

#### Declaration

```csharp
public override int GetHashCode()
```

#### Returns

| Type | Description |
| --- | --- |
| int |  |

### Implements

[IRelationSpecification](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.irelationspecification.html)
