Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Respawn.UnitTests/RespawnerTests.cs

This file was deleted.

1 change: 0 additions & 1 deletion Respawn/Respawn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.5" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="All" />
</ItemGroup>
Expand Down
39 changes: 1 addition & 38 deletions Respawn/Respawner.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using Respawn.Graph;
Expand All @@ -21,34 +20,7 @@ private Respawner(RespawnerOptions options)
}

/// <summary>
/// Creates a <see cref="Respawner" /> based on the supplied options and connection string or name. This overload only supports SQL Server.
/// </summary>
/// <param name="nameOrConnectionString">Name or connection string</param>
/// <param name="options">Options</param>
/// <returns>A respawner with generated SQL based on the supplied connection string</returns>
/// <exception cref="ArgumentException">Throws if the options are any other database adapter besides SQL</exception>
public static async Task<Respawner> CreateAsync(string nameOrConnectionString, RespawnerOptions? options = default)
{
options ??= new RespawnerOptions();

if (options.DbAdapter is not SqlServerDbAdapter)
{
throw new ArgumentException("This overload only supports the SqlDataAdapter. To use an alternative adapter, use the overload that supplies a DbConnection.", nameof(options.DbAdapter));
}

await using var connection = new SqlConnection(nameOrConnectionString);

await connection.OpenAsync().ConfigureAwait(false);

var respawner = new Respawner(options);

await respawner.BuildDeleteTables(connection).ConfigureAwait(false);

return respawner;
}

/// <summary>
/// Creates a <see cref="Respawner"/> based on the supplied connection and options.
/// Creates a <see cref="Respawner"/> based on the supplied connection and options.
/// </summary>
/// <param name="connection">Connection object for your target database</param>
/// <param name="options">Options</param>
Expand All @@ -64,15 +36,6 @@ public static async Task<Respawner> CreateAsync(DbConnection connection, Respawn
return respawner;
}

public virtual async Task ResetAsync(string nameOrConnectionString)
{
await using var connection = new SqlConnection(nameOrConnectionString);

await connection.OpenAsync().ConfigureAwait(false);

await ResetAsync(connection).ConfigureAwait(false);
}

public virtual async Task ResetAsync(DbConnection connection)
{
if (_temporalTables.Any())
Expand Down
Loading