This commit is contained in:
2025-10-27 17:39:18 -04:00
commit 31f723bea4
1579 changed files with 642409 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using Prefab.Handler;
namespace Prefab.Web.Data;
public class AppDbReadOnly(DbContextOptions<AppDbReadOnly> options, IHandlerContextAccessor accessor) : AppDb(options, accessor), Prefab.Data.IPrefabDbReadOnly,
Prefab.Catalog.Data.IModuleDbReadOnly
{
protected override void PrefabOnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.PrefabOnConfiguring(optionsBuilder);
optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
}
public override int SaveChanges()
=> throw new InvalidOperationException("This database context is read-only. Saving changes is not allowed.");
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
=> throw new InvalidOperationException("This database context is read-only. Saving changes is not allowed.");
}