mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-31 00:50:45 +01:00
More FxCop cleanups
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
<Rule Id="CA1027" Action="Warning" />
|
||||
<Rule Id="CA1028" Action="Warning" />
|
||||
<Rule Id="CA1030" Action="Warning" />
|
||||
<Rule Id="CA1031" Action="Warning" />
|
||||
<Rule Id="CA1031" Action="None" />
|
||||
<Rule Id="CA1032" Action="Warning" />
|
||||
<Rule Id="CA1033" Action="Warning" />
|
||||
<Rule Id="CA1034" Action="Warning" />
|
||||
|
||||
@@ -137,6 +137,9 @@ namespace Tgstation.Server.Api
|
||||
/// <param name="requestHeaders">The <see cref="RequestHeaders"/> containing the <see cref="ApiHeaders"/></param>
|
||||
public ApiHeaders(RequestHeaders requestHeaders)
|
||||
{
|
||||
if (requestHeaders == null)
|
||||
throw new ArgumentNullException(nameof(requestHeaders));
|
||||
|
||||
var jsonAccept = new Microsoft.Net.Http.Headers.MediaTypeHeaderValue(ApplicationJson);
|
||||
if (!requestHeaders.Accept.Any(x => x.MediaType == jsonAccept.MediaType))
|
||||
throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Client does not accept {0}!", ApplicationJson));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Tgstation.Server.Api.Models.Internal
|
||||
{
|
||||
@@ -43,7 +44,7 @@ namespace Tgstation.Server.Api.Models.Internal
|
||||
/// <param name="otherParameters">The <see cref="DreamDaemonLaunchParameters"/> to compare against</param>
|
||||
/// <returns><see langword="true"/> if they match, <see langword="false"/> otherwise</returns>
|
||||
public bool Match(DreamDaemonLaunchParameters otherParameters) =>
|
||||
AllowWebClient == otherParameters.AllowWebClient
|
||||
AllowWebClient == (otherParameters?.AllowWebClient ?? throw new ArgumentNullException(nameof(otherParameters)))
|
||||
&& SecurityLevel == otherParameters.SecurityLevel
|
||||
&& PrimaryPort == otherParameters.PrimaryPort
|
||||
&& SecondaryPort == otherParameters.SecondaryPort
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Microsoft.Extensions.Logging.EventLog;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
@@ -85,9 +84,7 @@ namespace Tgstation.Server.Host.Service
|
||||
Task.Run(Stop, cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (Exception e)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
EventLog.WriteEntry(String.Format(CultureInfo.InvariantCulture, "Error stopping service! Exception: {0}", e));
|
||||
}
|
||||
@@ -97,7 +94,6 @@ namespace Tgstation.Server.Host.Service
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "cancellationTokenSource", Justification = "IT'S DISPOSED RIGHT THERE YOU FUCCBOI!")]
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
cancellationTokenSource?.Dispose();
|
||||
|
||||
@@ -176,9 +176,9 @@ namespace Tgstation.Server.Host.Components.Compiler
|
||||
var dirA = ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName);
|
||||
|
||||
job.MinimumSecurityLevel = securityLevel; // needed for the TempDmbProvider
|
||||
var provider = new TemporaryDmbProvider(ioManager.ResolvePath(dirA), String.Concat(job.DmeName, DmbExtension), job);
|
||||
|
||||
var timeoutAt = DateTimeOffset.Now.AddSeconds(timeout);
|
||||
|
||||
using (var provider = new TemporaryDmbProvider(ioManager.ResolvePath(dirA), String.Concat(job.DmeName, DmbExtension), job))
|
||||
using (var controller = await sessionControllerFactory.LaunchNew(launchParameters, provider, byondLock, true, true, true, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
var launchResult = await controller.LaunchResult.ConfigureAwait(false);
|
||||
|
||||
@@ -296,29 +296,30 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
networkPromptReaper.RegisterProcess(process);
|
||||
result = new SessionController(reattachInformation, process, byondLock, byondTopicSender, chatJsonTrackingContext, context, chat, loggerFactory.CreateLogger<SessionController>(), null, null);
|
||||
|
||||
process = null;
|
||||
context = null;
|
||||
byondLock = null;
|
||||
chatJsonTrackingContext = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (result == null)
|
||||
process.Dispose();
|
||||
process?.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (result == null)
|
||||
context.Dispose();
|
||||
context?.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (result == null)
|
||||
byondLock.Dispose();
|
||||
byondLock?.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (result == null)
|
||||
chatJsonTrackingContext.Dispose();
|
||||
chatJsonTrackingContext?.Dispose();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -208,6 +208,10 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
DisposeAndNullControllers();
|
||||
semaphore.Dispose();
|
||||
restartRegistration.Dispose();
|
||||
|
||||
// mostly here to please fxcop, but it definitely should be disposed already
|
||||
Debug.Assert(monitorCts == null, "We reached Disposes() an monitorCts is not null!");
|
||||
monitorCts?.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -679,6 +683,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
monitorCts.Cancel();
|
||||
await monitorTask.ConfigureAwait(false);
|
||||
monitorCts.Dispose();
|
||||
monitorCts = null;
|
||||
monitorTask = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,8 @@ namespace Tgstation.Server.Host.Core
|
||||
await console.WriteAsync("Testing create DB permission...", true, cancellationToken).ConfigureAwait(false);
|
||||
using (var command = testConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = String.Format(CultureInfo.InvariantCulture, "CREATE DATABASE {0}", databaseName);
|
||||
command.CommandText = "CREATE DATABASE ?";
|
||||
command.Parameters.Add(databaseName);
|
||||
await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -282,7 +283,8 @@ namespace Tgstation.Server.Host.Core
|
||||
await console.WriteAsync("Dropping test database...", true, cancellationToken).ConfigureAwait(false);
|
||||
using (var command = testConnection.CreateCommand())
|
||||
{
|
||||
command.CommandText = String.Format(CultureInfo.InvariantCulture, "DROP DATABASE {0}", databaseName);
|
||||
command.CommandText = "DROP DATABASE ?";
|
||||
command.Parameters.Add(databaseName);
|
||||
try
|
||||
{
|
||||
await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
@@ -596,6 +599,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Jobs_Instances_InstanceId",
|
||||
table: "Jobs");
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
@@ -593,6 +596,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Jobs_Instances_InstanceId",
|
||||
table: "Jobs");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
using Tgstation.Server.Api.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
@@ -14,6 +15,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ApiValidationSecurityLevel",
|
||||
table: "DreamMakerSettings",
|
||||
@@ -33,6 +37,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApiValidationSecurityLevel",
|
||||
table: "DreamMakerSettings");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
using Tgstation.Server.Api.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
@@ -14,6 +15,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ApiValidationSecurityLevel",
|
||||
table: "DreamMakerSettings",
|
||||
@@ -33,6 +37,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApiValidationSecurityLevel",
|
||||
table: "DreamMakerSettings");
|
||||
|
||||
+6
@@ -14,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Instances_WatchdogReattachInformations_WatchdogReattachInfor~",
|
||||
table: "Instances");
|
||||
@@ -122,6 +125,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges");
|
||||
|
||||
+6
@@ -14,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Instances_WatchdogReattachInformations_WatchdogReattachInformationId",
|
||||
table: "Instances");
|
||||
@@ -120,6 +123,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges");
|
||||
|
||||
+7
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
@@ -13,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ReattachInformations_CompileJobs_CompileJobId",
|
||||
table: "ReattachInformations");
|
||||
@@ -39,6 +43,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ReattachInformations_CompileJobs_CompileJobId",
|
||||
table: "ReattachInformations");
|
||||
|
||||
+7
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
@@ -13,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ReattachInformations_CompileJobs_CompileJobId",
|
||||
table: "ReattachInformations");
|
||||
@@ -39,6 +43,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ReattachInformations_CompileJobs_CompileJobId",
|
||||
table: "ReattachInformations");
|
||||
|
||||
+7
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
@@ -13,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "PostTestMergeComment",
|
||||
table: "RepositorySettings",
|
||||
@@ -26,6 +30,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PostTestMergeComment",
|
||||
table: "RepositorySettings");
|
||||
|
||||
+7
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
@@ -13,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "PostTestMergeComment",
|
||||
table: "RepositorySettings",
|
||||
@@ -26,6 +30,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PostTestMergeComment",
|
||||
table: "RepositorySettings");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
@@ -13,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RevisionInformations_CommitSha",
|
||||
table: "RevisionInformations");
|
||||
@@ -34,6 +38,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RevisionInformations_InstanceId_CommitSha",
|
||||
table: "RevisionInformations");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
@@ -13,6 +14,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RevisionInformations_Instances_InstanceId",
|
||||
table: "RevisionInformations");
|
||||
@@ -46,6 +50,9 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
/// <param name="migrationBuilder">The <see cref="MigrationBuilder"/> to use</param>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RevisionInformations_Instances_InstanceId",
|
||||
table: "RevisionInformations");
|
||||
|
||||
@@ -7,7 +7,7 @@ using Tgstation.Server.Host.Configuration;
|
||||
namespace Tgstation.Server.Host.Models.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains helpers for creating design time <see cref="Models.DatabaseContext{TParentContext}"/>s
|
||||
/// Contains helpers for creating design time <see cref="DatabaseContext{TParentContext}"/>s
|
||||
/// </summary>
|
||||
static class DesignTimeDbContextFactoryHelpers
|
||||
{
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
sealed class MySqlDesignTimeDbContextFactory : IDesignTimeDbContextFactory<MySqlDatabaseContext>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public MySqlDatabaseContext CreateDbContext(string[] args) => new MySqlDatabaseContext(new DbContextOptions<MySqlDatabaseContext>(), DesignTimeDbContextFactoryHelpers.GetDbContextOptions(), new DatabaseSeeder(new CryptographySuite(new PasswordHasher<User>())), new LoggerFactory().CreateLogger<MySqlDatabaseContext>());
|
||||
public MySqlDatabaseContext CreateDbContext(string[] args)
|
||||
{
|
||||
using (var loggerFactory = LoggerFactory.Create(builder => { }))
|
||||
{
|
||||
return new MySqlDatabaseContext(new DbContextOptions<MySqlDatabaseContext>(), DesignTimeDbContextFactoryHelpers.GetDbContextOptions(), new DatabaseSeeder(new CryptographySuite(new PasswordHasher<User>())), loggerFactory.CreateLogger<MySqlDatabaseContext>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace Tgstation.Server.Host.Models.Migrations
|
||||
sealed class SqlServerDesignTimeDbContextFactory : IDesignTimeDbContextFactory<SqlServerDatabaseContext>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public SqlServerDatabaseContext CreateDbContext(string[] args) => new SqlServerDatabaseContext(new DbContextOptions<SqlServerDatabaseContext>(), DesignTimeDbContextFactoryHelpers.GetDbContextOptions(), new DatabaseSeeder(new CryptographySuite(new PasswordHasher<User>())), new LoggerFactory().CreateLogger<SqlServerDatabaseContext>());
|
||||
public SqlServerDatabaseContext CreateDbContext(string[] args)
|
||||
{
|
||||
using (var loggerFactory = LoggerFactory.Create(builder => { }))
|
||||
{
|
||||
return new SqlServerDatabaseContext(new DbContextOptions<SqlServerDatabaseContext>(), DesignTimeDbContextFactoryHelpers.GetDbContextOptions(), new DatabaseSeeder(new CryptographySuite(new PasswordHasher<User>())), loggerFactory.CreateLogger<SqlServerDatabaseContext>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,14 @@
|
||||
<Content Remove="ClientApp\tslint.json" />
|
||||
<ClientApp Include="ClientApp\src\**\*;ClientApp\public\**\*;ClientApp\tsconfig.json;ClientApp\tslint.json;ClientApp\package.json;ClientApp\package-lock.json" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="NpmBuild" BeforeTargets="BeforeBuild" DependsOnTargets="NpmInstall" Inputs="@(ClientApp)" Outputs="wwwroot\index.html">
|
||||
<Exec WorkingDirectory="ClientApp" Command="npm run msbuild" />
|
||||
</Target>
|
||||
|
||||
<Target Name="NpmClean" AfterTargets="Clean">
|
||||
<RemoveDir Directories="wwwroot" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BetterWin32Errors" Version="0.2.0" />
|
||||
|
||||
Reference in New Issue
Block a user