Class SqlOptions

Namespace
ProtoTest.Sql
Assembly
ProtoTest.Sql.dll

Configures how ProtoTest owns and isolates a database connection during a test.

public sealed class SqlOptions : IProtoConfigurableOptions
Inheritance
SqlOptions
Implements
Inherited Members
Extension Methods

Fields

ConfigurationSectionName

public const string ConfigurationSectionName = "ProtoTest:Sql"

Field Value

string

Properties

Isolation

Gets or sets the isolation applied to each test. Defaults to Transaction.

public SqlIsolation Isolation { get; set; }

Property Value

SqlIsolation

SharedWith

Gets the applications declared as using the test's connection.

public IReadOnlyCollection<string> SharedWith { get; }

Property Value

IReadOnlyCollection<string>

SharedWithApplications

Gets or sets the applications declared as sharing the test's connection, for configuration binding (ProtoTest:Sql:SharedWithApplications). Prefer ShareConnectionWith(params string[]).

public List<string> SharedWithApplications { get; set; }

Property Value

List<string>

Methods

ShareConnectionWith(params string[])

Declares that an application uses the connection ProtoTest owns, so Transaction rolls back the application's writes too. When the host registers applications, every one of them must be declared for the transaction strategy to run.

public SqlOptions ShareConnectionWith(params string[] applicationNames)

Parameters

applicationNames string[]

Returns

SqlOptions

SharesConnectionWith(string)

Returns whether an application was declared as sharing the test's connection.

public bool SharesConnectionWith(string applicationName)

Parameters

applicationName string

Returns

bool