0
0

Remove interface that's not adding much value + other minor cleanups

This commit is contained in:
Rhys Ickeringill
2025-12-28 17:13:43 +11:00
parent 0c824f268c
commit 7ab61f8ff9
2 changed files with 7 additions and 13 deletions

View File

@@ -1,5 +1,4 @@
using System; using System.Linq;
using System.Linq;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
@@ -17,9 +16,9 @@ internal interface IEntityFrameworkCoreDbSetConfigurationProvider : IConfigurati
internal class EntityFrameworkCoreDbSetConfigurationProvider<TDbContext> : ConfigurationProvider, IEntityFrameworkCoreDbSetConfigurationProvider internal class EntityFrameworkCoreDbSetConfigurationProvider<TDbContext> : ConfigurationProvider, IEntityFrameworkCoreDbSetConfigurationProvider
where TDbContext : DbContext, ISettingsDbContext<IQueryable<ISetting>> where TDbContext : DbContext, ISettingsDbContext<IQueryable<ISetting>>
{ {
private readonly IEntityFrameworkCoreDbSetConfigurationSource<TDbContext> _configurationSource; private readonly EntityFrameworkCoreDbSetConfigurationSource<TDbContext> _configurationSource;
internal EntityFrameworkCoreDbSetConfigurationProvider(IEntityFrameworkCoreDbSetConfigurationSource<TDbContext> configurationSource) : base() internal EntityFrameworkCoreDbSetConfigurationProvider(EntityFrameworkCoreDbSetConfigurationSource<TDbContext> configurationSource) : base()
{ {
_configurationSource = configurationSource; _configurationSource = configurationSource;
} }
@@ -35,15 +34,11 @@ internal class EntityFrameworkCoreDbSetConfigurationProvider<TDbContext> : Confi
public new void OnReload() => base.OnReload(); public new void OnReload() => base.OnReload();
} }
internal interface IEntityFrameworkCoreDbSetConfigurationSource<TDbContext> where TDbContext : DbContext
{
internal Func<TDbContext> DbContextFactory { get; }
}
internal class EntityFrameworkCoreDbSetConfigurationSource<TDbContext> : IConfigurationSource, IEntityFrameworkCoreDbSetConfigurationSource<TDbContext> internal class EntityFrameworkCoreDbSetConfigurationSource<TDbContext> : IConfigurationSource
where TDbContext : DbContext, ISettingsDbContext<IQueryable<ISetting>> where TDbContext : DbContext, ISettingsDbContext<IQueryable<ISetting>>
{ {
public required Func<TDbContext> DbContextFactory { get; init; } public required System.Func<TDbContext> DbContextFactory { get; init; }
public IConfigurationProvider Build(IConfigurationBuilder builder) public IConfigurationProvider Build(IConfigurationBuilder builder)
{ {

View File

@@ -1,10 +1,9 @@
using System; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace RAIC.Extensions.Configuration.EntityFrameworkCore; namespace RAIC.Extensions.Configuration.EntityFrameworkCore;
public interface ISettingsDbContext<out TSettings> : IDisposable public interface ISettingsDbContext<out TSettings> : System.IDisposable
where TSettings : System.Linq.IQueryable<ISetting> where TSettings : System.Linq.IQueryable<ISetting>
{ {
TSettings Settings { get; } TSettings Settings { get; }