Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
Open
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System;
using System.Reflection;
using IdentityServer4.EntityFramework.Storage;
using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
Expand All @@ -21,6 +22,7 @@ public static class DatabaseExtensions
/// <typeparam name="TLogDbContext"></typeparam>
/// <typeparam name="TIdentityDbContext"></typeparam>
/// <typeparam name="TAuditLoggingDbContext"></typeparam>
/// <typeparam name="TDataProtectionDbContext"></typeparam>
/// <param name="services"></param>
/// <param name="connectionStrings"></param>
/// <param name="databaseMigrations"></param>
Expand All @@ -42,6 +44,8 @@ public static class DatabaseExtensions
services.AddDbContext<TIdentityDbContext>(options =>
options.UseNpgsql(connectionStrings.IdentityDbConnection, sql => sql.MigrationsAssembly(databaseMigrations.IdentityDbMigrationsAssembly ?? migrationsAssembly)));

AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

// Config DB from existing connection
services.AddConfigurationDbContext<TConfigurationDbContext>(options =>
options.ConfigureDbContext = b =>
Expand Down Expand Up @@ -88,6 +92,8 @@ public static class DatabaseExtensions
{
var migrationsAssembly = typeof(DatabaseExtensions).GetTypeInfo().Assembly.GetName().Name;

AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

// Config DB for identity
services.AddDbContext<TIdentityDbContext>(options => options.UseNpgsql(identityConnectionString, sql => sql.MigrationsAssembly(migrationsAssembly)));

Expand Down