Some checks failed
Release / build-and-push (map[dockerfile:FictionArchive.API/Dockerfile name:api]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.AuthenticationService/Dockerfile name:authentication-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.FileService/Dockerfile name:file-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.NovelService/Dockerfile name:novel-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.SchedulerService/Dockerfile name:scheduler-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.TranslationService/Dockerfile name:translation-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.UserService/Dockerfile name:user-service]) (pull_request) Has been cancelled
Release / build-frontend (pull_request) Has been cancelled
Build Gateway / build-subgraphs (map[name:novel-service project:FictionArchive.Service.NovelService subgraph:Novel]) (pull_request) Failing after 51s
Build Gateway / build-subgraphs (map[name:translation-service project:FictionArchive.Service.TranslationService subgraph:Translation]) (pull_request) Has been cancelled
Build Gateway / build-subgraphs (map[name:user-service project:FictionArchive.Service.UserService subgraph:User]) (pull_request) Has been cancelled
Build Gateway / build-gateway (pull_request) Has been cancelled
Build Gateway / build-subgraphs (map[name:scheduler-service project:FictionArchive.Service.SchedulerService subgraph:Scheduler]) (pull_request) Has been cancelled
CI / build-frontend (pull_request) Has been cancelled
CI / build-backend (pull_request) Has been cancelled
34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
using FictionArchive.Service.Shared.Services.Database;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace FictionArchive.Service.Shared.Extensions;
|
|
|
|
public static class DatabaseExtensions
|
|
{
|
|
public static IServiceCollection RegisterDbContext<TContext>(
|
|
this IServiceCollection services,
|
|
string connectionString,
|
|
bool skipInfrastructure = false) where TContext : FictionArchiveDbContext
|
|
{
|
|
if (skipInfrastructure)
|
|
{
|
|
// For schema export: use in-memory provider to allow EF Core entity discovery
|
|
services.AddDbContext<TContext>(options =>
|
|
{
|
|
options.UseInMemoryDatabase($"SchemaExport_{typeof(TContext).Name}");
|
|
});
|
|
}
|
|
else
|
|
{
|
|
services.AddDbContext<TContext>(options =>
|
|
{
|
|
options.UseNpgsql(connectionString, o =>
|
|
{
|
|
o.UseNodaTime();
|
|
});
|
|
});
|
|
}
|
|
return services;
|
|
}
|
|
} |