| | | 1 | | namespace ZhEaIsNsAaBn.APPSettings; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Settings shared by the configuration source, the provider and the writer. Filled by the |
| | | 5 | | /// <see cref="IEFConfigurationBuilder{TSettingsTable, TDbContext}"/>. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <typeparam name="TSettingsTable">The settings entity.</typeparam> |
| | | 8 | | /// <typeparam name="TDbContext">The context that holds the settings table.</typeparam> |
| | | 9 | | public sealed class EFConfigurationProviderSettings< TSettingsTable, TDbContext > |
| | | 10 | | where TSettingsTable : class, IEFConfigurationValue, new() |
| | | 11 | | where TDbContext : DbContext |
| | | 12 | | { |
| | | 13 | | /// <summary>Creates the contexts used to read and write the settings table. Required before the first load.</summar |
| | | 14 | | public IDbContextFactory<TDbContext>? DbContextFactory { get; set; } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Automatic reload after the settings table is saved. Not implemented yet (only turns on the reloader). Default: < |
| | | 18 | | /// </summary> |
| | | 19 | | public bool ReloadOnChange { get; set; } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Milliseconds an automatic reload waits before reading, so a save can finish first. Reserved; not used yet. Defau |
| | | 23 | | /// </summary> |
| | 56 | 24 | | public int ReloadDelay { get; set; } = 500; |
| | | 25 | | |
| | | 26 | | /// <summary>Filter applied when reading and updating rows, e.g. one environment. Default: all rows.</summary> |
| | 56 | 27 | | public Expression<Func<TSettingsTable, bool>> Query { get; set; } = _ => true; |
| | | 28 | | |
| | | 29 | | |
| | | 30 | | internal IDbContextFactory<TDbContext> GetRequiredDbContextFactory() |
| | 128 | 31 | | => DbContextFactory ?? throw new InvalidOperationException( $"No IDbContextFactory<{typeof( TDbContext ).Name}> |
| | | 32 | | } |