This commit is contained in:
2026-05-17 20:54:09 -04:00
parent 6da2183583
commit 74c21ee5cc
3000 changed files with 11794 additions and 15301 deletions

View File

@@ -0,0 +1,28 @@

using Microsoft.EntityFrameworkCore;
using System.Runtime.InteropServices.Marshalling;
namespace OpenArchival.DataAccess;
public static class HomepageConfigurationSeeder
{
public static async Task SeedHomepageConfig(IServiceProvider serviceProvider)
{
var contextFactory = serviceProvider.GetRequiredService<IDbContextFactory<ApplicationDbContext>>();
await using var context = await contextFactory.CreateDbContextAsync();
HomePageConfiguration? existingConfig = await context.HomePageConfiguration.FirstOrDefaultAsync();
if (existingConfig == null)
{
var config = new HomePageConfiguration() {
Content = "<p>No homepage content configured</p>",
HomePageBanner = null,
SliderEntries = null
};
context.HomePageConfiguration.Add(config);
await context.SaveChangesAsync();
}
}
}