Remove ConfigureDbModel from dependency injection setup
Eliminated all references to ConfigureDbModel in DependencyInjection.cs, including related imports, configuration methods, and required service tracking. Dependency injection configuration is otherwise unchanged.
This commit is contained in:
@@ -6,7 +6,6 @@ using ReC.Application.Common.Behaviors;
|
|||||||
using ReC.Application.Common.Behaviors.InvokeAction;
|
using ReC.Application.Common.Behaviors.InvokeAction;
|
||||||
using ReC.Application.Common.Constants;
|
using ReC.Application.Common.Constants;
|
||||||
using ReC.Application.Common.Options;
|
using ReC.Application.Common.Options;
|
||||||
using ReC.Application.Common.Options.DbModel;
|
|
||||||
using ReC.Application.RecActions.Commands;
|
using ReC.Application.RecActions.Commands;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
@@ -57,8 +56,7 @@ public static class DependencyInjection
|
|||||||
private readonly Dictionary<string, bool> _requiredServices = new()
|
private readonly Dictionary<string, bool> _requiredServices = new()
|
||||||
{
|
{
|
||||||
{ nameof(ConfigureRecActions), false },
|
{ nameof(ConfigureRecActions), false },
|
||||||
{ nameof(LuckyPennySoftwareLicenseKey), false },
|
{ nameof(LuckyPennySoftwareLicenseKey), false }
|
||||||
{ nameof(ConfigureDbModel), false }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
internal void EnsureRequiredServices()
|
internal void EnsureRequiredServices()
|
||||||
@@ -140,29 +138,5 @@ public static class DependencyInjection
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
#endregion ConfigureSqlException
|
#endregion ConfigureSqlException
|
||||||
|
|
||||||
#region ConfigureDbModel
|
|
||||||
public ConfigurationOptions ConfigureDbModel(Action<DbModelOptions> configure)
|
|
||||||
{
|
|
||||||
_configActions.Enqueue(services => services.Configure(configure));
|
|
||||||
|
|
||||||
if (_requiredServices[nameof(ConfigureDbModel)])
|
|
||||||
throw new InvalidOperationException("DbModelOptions have already been configured.");
|
|
||||||
_requiredServices[nameof(ConfigureDbModel)] = true;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConfigurationOptions ConfigureDbModel(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_configActions.Enqueue(services => services.Configure<DbModelOptions>(configuration));
|
|
||||||
|
|
||||||
if (_requiredServices[nameof(ConfigureDbModel)])
|
|
||||||
throw new InvalidOperationException("DbModelOptions have already been configured.");
|
|
||||||
_requiredServices[nameof(ConfigureDbModel)] = true;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
#endregion ConfigureDbModel
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user