Show / Hide Table of Contents

Interface IInstanceSettingsService

Represents the instance settings API service.

Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IInstanceSettingsService
Examples
private readonly IInstanceSettingsService _instanceSettingsService;
...
_instanceSettingsService = relativityFacade.Resolve<IInstanceSettingsService>();

Methods

| Improve this Doc View Source

AddValue(String, String, String, String)

Adds a value to an existing InstanceSetting.

Declaration
void AddValue(string name, string section, string value, string delimiter)
Parameters
Type Name Description
System.String name

The name of existing instance setting.

System.String section

The section of existing instance setting.

System.String value

The value to add.

System.String delimiter

The delimiter wich split old and new value.

Examples

In this example, ";ThisIsIt" is added to the value that is in the MyNewSection:MyNewInstanceSetting instance setting.

InstanceSetting instancesetting = _instanceSettingsService.AddValue("MyNewInstanceSetting", "MyNewSection", "ThisIsIt", ";");
| Improve this Doc View Source

Create(InstanceSetting)

Creates the specified InstanceSetting.

Declaration
InstanceSetting Create(InstanceSetting entity)
Parameters
Type Name Description
InstanceSetting entity

The entity to create.

Returns
Type Description
InstanceSetting

The created entity.

Examples
InstanceSetting instanceSetting = new InstanceSetting
{
    Name = "MySpecialInstanceSetting",
    Value = "4",
    Description = "This instance setting does something.",
    Section = "Relativity.Example",
    Machine = "Bert Kreischer",
    InitialValue = "An initial value.",
    ValueType = InstanceSettingValueType.PositiveInt32
};

InstanceSetting result = _instanceSettingsService.Create(instanceSetting);
| Improve this Doc View Source

Delete(Int32)

Deletes the InstanceSetting by ArtifactId.

Declaration
void Delete(int id)
Parameters
Type Name Description
System.Int32 id

The artifact ID of the instance settings.

Examples
_instanceSettingsService.Delete(1234567);
| Improve this Doc View Source

Get(Int32)

Gets the instance settings by the specified ID.

Declaration
InstanceSetting Get(int id)
Parameters
Type Name Description
System.Int32 id

The artifact ID of the instance settings.

Returns
Type Description
InstanceSetting

The InstanceSetting entity or null.

Examples
InstanceSetting instancesetting = _instanceSettingsService.Get(1234567);
| Improve this Doc View Source

Get(String, String)

Gets the instance setting by the specified name and section.

Declaration
InstanceSetting Get(string name, string section)
Parameters
Type Name Description
System.String name

The name of the instance setting.

System.String section

The section of the instance setting.

Returns
Type Description
InstanceSetting

The InstanceSetting entity or null.

Examples
InstanceSetting instancesetting = _instanceSettingsService.Get("MyNewInstanceSetting", "MyNewSection");
| Improve this Doc View Source

Require(InstanceSetting)

Creates the specified [InstanceSetting](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.InstanceSetting.html) if it does not exist.

If it does exist, it will be updated instead.

  1. If [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of entity has positive value, gets entity by ID and returns it.
  2. If [Name](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.NamedArtifact.html#Relativity_Testing_Framework_Models_NamedArtifact_Name) and [InstanceSetting.Section](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.InstanceSetting.html#Relativity_Testing_Framework_Models_InstanceSetting_Section) properties of entity have a value, gets entity by name and returns it if it exists.
  3. Otherwise creates a new entity using [ICreateStrategy<T>](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Strategies.ICreateStrategy-1.html).
Declaration
InstanceSetting Require(InstanceSetting entity)
Parameters
Type Name Description
InstanceSetting entity

The entity to require.

Returns
Type Description
InstanceSetting

The entity required.

Examples

In this example, the instance setting does not exist, so it will be created.

InstanceSetting instanceSetting = new InstanceSetting
{
    Name = "MySpecialInstanceSetting",
    Value = "4",
    Description = "This instance setting does something.",
    Section = "Relativity.Example",
    Machine = "SomeMachine",
    InitialValue = "An initial value.",
    ValueType = InstanceSettingValueType.PositiveInt32
};

InstanceSetting result = _instanceSettingsService.Require(instanceSetting);

In this example, the newly created instance setting will be updated to have the new value property that was passed in.

InstanceSetting instanceSetting = new InstanceSetting
{
    Name = "MySpecialInstanceSetting",
    Value = "4",
    Description = "This instance setting does something.",
    Section = "Relativity.Example",
    Machine = "SomeMachine",
    InitialValue = "An initial value.",
    ValueType = InstanceSettingValueType.PositiveInt32
};

InstanceSetting result = _instanceSettingsService.Create(entity);

result.Value = 111;

InstanceSetting newResult = _instanceSettingsService.Require(entity);
| Improve this Doc View Source

Require(String, String, String)

Creates the specified [InstanceSetting](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.InstanceSetting.html) if it does not exist.

The instance setting will be looked up by name and section. If it does exist, it will be updated instead.

Declaration
InstanceSetting Require(string name, string section, string value)
Parameters
Type Name Description
System.String name

The name of the instance setting.

System.String section

The section of the instance setting.

System.String value

The value of the instance setting.

Returns
Type Description
InstanceSetting

The instance setting required.

Examples
InstanceSetting result = _instanceSettingsService.Require("MyNewInstanceSetting", "TheSectionOfMyNewInstanceSetting", "TheValueOfMyNewInstanceSetting");
| Improve this Doc View Source

RequireContainsValue(String, String, String, String)

Ensures that the value exists in the InstanceSetting with the passed in name and section.

Declaration
void RequireContainsValue(string name, string section, string value, string delimiter)
Parameters
Type Name Description
System.String name

The name of existing instance setting.

System.String section

The section of existing instance setting.

System.String value

The value to add.

System.String delimiter

The delimiter wich split old and new value.

Examples
InstanceSetting instanceSetting = new InstanceSetting
{
    Name = "MySpecialInstanceSetting",
    Value = "4",
    Description = "This instance setting does something.",
    Section = "Relativity.Example",
    InitialValue = "1;2;3",
    ValueType = InstanceSettingValueType.PositiveInt32
};

InstanceSetting result = _instanceSettingsService.Create(instanceSetting);

// After running this line, Relativity.Example:MySpecialInstanceSetting will have the value "1;2;3;4"
_instanceSettingsService.AddValue("MySpecialInstanceSetting", "Relativity.Example", "4", ";");
| Improve this Doc View Source

RequireNotContainsValue(String, String, String, String)

Ensures that the value does not exist in the [InstanceSetting](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.InstanceSetting.html) with the passed in name and section.

If the value of the instance setting is an exact match, the entire instance setting will be deleted.

Otherwise, the value will just be removed from the delimited string.

Declaration
void RequireNotContainsValue(string name, string section, string value, string delimiter)
Parameters
Type Name Description
System.String name

The name of existing instance setting.

System.String section

The section of existing instance setting.

System.String value

The value to add.

System.String delimiter

The delimiter wich split old and new value.

| Improve this Doc View Source

Update(InstanceSetting)

Updates the [InstanceSetting](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.InstanceSetting.html) by specified entity.

If specified, the ArtifactId on the model will be used to locate the InstanceSetting.

Otherwise, the InstanceSetting will be looked up by Name and Section.

Declaration
void Update(InstanceSetting entity)
Parameters
Type Name Description
InstanceSetting entity

The entity to update.

Examples
InstanceSetting instanceSetting = new InstanceSetting
{
    ArtifactID = 1234567,
    Value = "4"
};

InstanceSetting result = _instanceSettingsService.Update(instanceSetting);
InstanceSetting instanceSetting = new InstanceSetting
{
    Name = "InstanceSettingName",
    Section = "InstanceSettingSection",
    Value = "4"
};

InstanceSetting result = _instanceSettingsService.Update(instanceSetting);
| Improve this Doc View Source

UpdateValue(String, String, String)

Updates value of an existing InstanceSetting.

Declaration
void UpdateValue(string name, string section, string value)
Parameters
Type Name Description
System.String name

The name of the instance setting.

System.String section

The section of theinstance setting.

System.String value

The value to set.

Examples
InstanceSetting instancesetting = _instanceSettingsService.UpdateValue("MyNewInstanceSetting", "MyNewSection", "ThisIsIt");
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX