Skip to content

Commit

Permalink
Update packages to stable and fix bug that occurs after a container r…
Browse files Browse the repository at this point in the history
…eceives 20 requests
  • Loading branch information
NixFey committed Jan 19, 2025
1 parent 330dd45 commit 788c535
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions FiMAdminApi.Data/FiMAdminApi.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.NamingConventions" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-rc.2.24474.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.0-rc.2-ci.20240930T080442" />
<PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
<PackageReference Include="Supabase.Postgrest" Version="4.0.3" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions FiMAdminApi/FiMAdminApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0-rc.2.24474.3" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0-rc.2.24474.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" />
<PackageReference Include="MiniValidation" Version="0.9.1" />
<PackageReference Include="Supabase" Version="1.1.1" />
<PackageReference Include="System.Collections" Version="4.3.0" />
Expand Down
9 changes: 8 additions & 1 deletion FiMAdminApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,18 @@
throw new ApplicationException("FiM Connection String is required");
}

// IMPORTANT!
// This null name translator should be a singleton, and should *not* be
// refactored back inside the `AddDbContext`. Having a new one constructed
// every time confuses EF's ServiceProviderCache, meaning it has to use a new
// service provider for every request.
var nullNameTranslator = new NpgsqlNullNameTranslator();

builder.Services.AddDbContext<DataContext>(opt =>
{
opt.UseSnakeCaseNamingConvention();
opt.UseNpgsql(connectionString,
o => o.MapEnum<TournamentLevel>("tournament_level", nameTranslator: new NpgsqlNullNameTranslator()));
o => o.MapEnum<TournamentLevel>("tournament_level", nameTranslator: nullNameTranslator));
});

// For most authn/authz we're using tokens directly from Supabase. These tokens get validated by the supabase auth
Expand Down

0 comments on commit 788c535

Please sign in to comment.