Resolve all high-severity architecture review findings
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
internal static class ConfigurationTransactionTestExtensions
|
||||
{
|
||||
public static ServiceCollection AddTestConfigurationTransaction(this ServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IConfigurationCommandTransaction, RepositoryTransaction>();
|
||||
services.AddScoped<ZB.MOM.WW.ScadaBridge.TemplateEngine.Services.AreaService>();
|
||||
return services;
|
||||
}
|
||||
private sealed class RepositoryTransaction(IServiceScopeFactory scopes) : IConfigurationCommandTransaction
|
||||
{
|
||||
public async Task<object?> ExecuteAsync(Func<IServiceProvider, Task<object?>> operation)
|
||||
{
|
||||
using var scope = scopes.CreateScope();
|
||||
return await operation(scope.ServiceProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user