Skip to content

Commit

Permalink
Switch back to constants for parameterized collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss committed Jan 2, 2025
1 parent 6391b73 commit 458b09d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfig
serverVersion,
mySqlOptions =>
{
mySqlOptions.TranslateParameterizedCollectionsToConstants();
mySqlOptions.EnableRetryOnFailure();
mySqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfig
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
options.UseNpgsql(databaseConfiguration.ConnectionString, options =>
{
options.TranslateParameterizedCollectionsToConstants();
options.EnableRetryOnFailure();
options.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfig
databaseConfiguration.ConnectionString,
sqlServerOptions =>
{
sqlServerOptions.TranslateParameterizedCollectionsToConstants();
sqlServerOptions.EnableRetryOnFailure();
sqlServerOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
});
Expand Down
6 changes: 5 additions & 1 deletion src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public static void ConfigureWith(
if (databaseConfiguration.DatabaseType != DatabaseType.Sqlite)
throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqliteDatabaseContext)}!");

options.UseSqlite(databaseConfiguration.ConnectionString, sqliteOptions => sqliteOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery));
options.UseSqlite(databaseConfiguration.ConnectionString, sqliteOptions =>
{
sqliteOptions.TranslateParameterizedCollectionsToConstants();
sqliteOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
});
}

/// <inheritdoc />
Expand Down

0 comments on commit 458b09d

Please sign in to comment.