mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(directory): ✨ throw if readonly context SaveChanges is called
This commit is contained in:
parent
5216d9577d
commit
3f83b6edf2
1 changed files with 12 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;
|
||||
using FilterLists.Directory.Infrastructure.Persistence.Queries.Mappings;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -19,6 +21,16 @@ public DirectoryQueryDbContext(DbContextOptions<DirectoryQueryDbContext> options
|
|||
public DbSet<Syntax> Syntaxes => Set<Syntax>();
|
||||
public DbSet<Tag> Tags => Set<Tag>();
|
||||
|
||||
public override int SaveChanges(bool acceptAllChangesOnSuccess)
|
||||
{
|
||||
throw new InvalidOperationException("This context is read-only.");
|
||||
}
|
||||
|
||||
public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
throw new InvalidOperationException("This context is read-only.");
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
_ = modelBuilder ?? throw new ArgumentNullException(nameof(modelBuilder));
|
||||
|
|
|
|||
Loading…
Reference in a new issue