| | | 1 | | using Microsoft.EntityFrameworkCore; |
| | | 2 | | using Microsoft.EntityFrameworkCore.ChangeTracking; |
| | | 3 | | |
| | | 4 | | namespace ClientManager.Shared.Data; |
| | | 5 | | |
| | | 6 | | public class ReadOnlyAppDbContext : AppDbContext |
| | | 7 | | { |
| | | 8 | | public ReadOnlyAppDbContext(DbContextOptions<ReadOnlyAppDbContext> options) |
| | 16 | 9 | | : base(options) { } |
| | | 10 | | |
| | 1 | 11 | | public override int SaveChanges() => throw new InvalidOperationException("This context is read-only."); |
| | | 12 | | |
| | 0 | 13 | | public override int SaveChanges(bool acceptAllChangesOnSuccess) => throw new InvalidOperationException("This context |
| | | 14 | | |
| | 1 | 15 | | public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default) => throw new InvalidOperat |
| | | 16 | | |
| | | 17 | | public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = def |
| | 0 | 18 | | throw new InvalidOperationException("This context is read-only."); |
| | | 19 | | |
| | 1 | 20 | | public override EntityEntry<TEntity> Add<TEntity>(TEntity entity) => throw new InvalidOperationException("Cannot cal |
| | | 21 | | |
| | | 22 | | public override ValueTask<EntityEntry<TEntity>> AddAsync<TEntity>(TEntity entity, CancellationToken cancellationToke |
| | 1 | 23 | | throw new InvalidOperationException("Cannot call 'Update' — this DbContext is read-only."); |
| | | 24 | | |
| | 1 | 25 | | public override EntityEntry<TEntity> Update<TEntity>(TEntity entity) => throw new InvalidOperationException("Cannot |
| | | 26 | | |
| | 1 | 27 | | public override EntityEntry<TEntity> Remove<TEntity>(TEntity entity) => throw new InvalidOperationException("Cannot |
| | | 28 | | } |