You've already forked Extensions.Configuration.EntityFrameworkCore
Remove unnecessary TSetting type parameter from ISettingsDbContext & just use ISetting instead
This commit is contained in:
@@ -10,8 +10,7 @@ public static class ConfigurationBuilderExtensions
|
||||
/// <summary>
|
||||
/// Adds a <see cref="DbSet{}"/> off <typeparamref name="TDbContext"/> as a configuration provider to the <see cref="IConfigurationBuilder"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDbContext">Type of the <see cref="DbContext"/> which implements <see cref="ISettingsDbContext{,}"/></typeparam>
|
||||
/// <typeparam name="TSetting">Concrete type which implements <see cref="ISetting"/></typeparam>
|
||||
/// <typeparam name="TDbContext">Type of the <see cref="DbContext"/> which implements both <see cref="ISettingsDbContext{}"/> and <see cref="ISettingsDbContextFactory{}"/></typeparam>
|
||||
/// <param name="optionsTransformer">
|
||||
/// a <see cref="DbContextOptionsTransformer{}"/> which configures your <see cref="DbContextOptions{}"/>. eg.
|
||||
/// <code>
|
||||
@@ -19,12 +18,11 @@ public static class ConfigurationBuilderExtensions
|
||||
/// </code>
|
||||
/// </param>
|
||||
/// <returns>The <see cref="IConfigurationBuilder"/></returns>
|
||||
public static IConfigurationBuilder AddDbSet<TDbContext, TSetting>(this IConfigurationBuilder builder, DbContextOptionsTransformer<TDbContext> optionsTransformer)
|
||||
where TDbContext : DbContext, ISettingsDbContext<DbSet<TSetting>, TSetting>, ISettingsDbContextFactory<TDbContext>
|
||||
where TSetting : class, ISetting
|
||||
public static IConfigurationBuilder AddDbContext<TDbContext>(this IConfigurationBuilder builder, DbContextOptionsTransformer<TDbContext> optionsTransformer)
|
||||
where TDbContext : DbContext, ISettingsDbContext<System.Linq.IQueryable<ISetting>>, ISettingsDbContextFactory<TDbContext>
|
||||
{
|
||||
var options = optionsTransformer(new DbContextOptionsBuilder<TDbContext>()).Options;
|
||||
var configurationSource = new EntityFrameworkCoreDbSetConfigurationSource<TDbContext, TSetting>()
|
||||
var configurationSource = new EntityFrameworkCoreDbSetConfigurationSource<TDbContext>()
|
||||
{
|
||||
DbContextFactory = () => TDbContext.Create(options)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user