Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 9047e96

Browse files
committed
Resolved issue #20
closes #20
1 parent 640961f commit 9047e96

File tree

2 files changed

+16
-45
lines changed

2 files changed

+16
-45
lines changed

src/NET6CustomLibrary/Extensions/DependencyInjection.cs

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,15 @@ public static IServiceCollection AddDbContextGenericsMethods<TDbContext>(this IS
112112
return services;
113113
}
114114

115-
public static IServiceCollection AddDbContextTransactionMethods<TDbContext>(this IServiceCollection services) where TDbContext : DbContext
116-
{
117-
services.AddScoped<DbContext, TDbContext>();
118-
services.AddScoped(typeof(ITUnitOfWork<,>), typeof(TUnitOfWork<,>));
119-
services.AddScoped(typeof(IRepository<,>), typeof(Repository<,>));
115+
//public static IServiceCollection AddDbContextTransactionMethods<TDbContext>(this IServiceCollection services) where TDbContext : DbContext
116+
//{
117+
// services.AddScoped<DbContext, TDbContext>();
118+
// services.AddScoped(typeof(ITUnitOfWork<,>), typeof(TUnitOfWork<,>));
119+
// services.AddScoped(typeof(IRepository<,>), typeof(Repository<,>));
120120

121-
return services;
122-
}
121+
// return services;
122+
//}
123123

124-
/// <summary>
125-
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider MySQL / MariaDB
126-
/// </summary>
127-
/// <typeparam name="TDbContext"></typeparam>
128-
/// <param name="services"></param>
129-
/// <param name="connectionString"></param>
130-
/// <param name="retryOnFailure"></param>
131-
/// <returns></returns>
132124
public static IServiceCollection AddDbContextUseMySql<TDbContext>(this IServiceCollection services, string connectionString, int retryOnFailure) where TDbContext : DbContext
133125
{
134126
services.AddDbContextPool<TDbContext>(optionBuilder =>
@@ -150,14 +142,6 @@ public static IServiceCollection AddDbContextUseMySql<TDbContext>(this IServiceC
150142
return services;
151143
}
152144

153-
/// <summary>
154-
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider Postgres
155-
/// </summary>
156-
/// <typeparam name="TDbContext"></typeparam>
157-
/// <param name="services"></param>
158-
/// <param name="connectionString"></param>
159-
/// <param name="retryOnFailure"></param>
160-
/// <returns></returns>
161145
public static IServiceCollection AddDbContextUsePostgres<TDbContext>(this IServiceCollection services, string connectionString, int retryOnFailure) where TDbContext : DbContext
162146
{
163147
services.AddDbContextPool<TDbContext>(optionBuilder =>
@@ -180,14 +164,6 @@ public static IServiceCollection AddDbContextUsePostgres<TDbContext>(this IServi
180164
return services;
181165
}
182166

183-
/// <summary>
184-
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider SQL Server
185-
/// </summary>
186-
/// <typeparam name="TDbContext"></typeparam>
187-
/// <param name="services"></param>
188-
/// <param name="connectionString"></param>
189-
/// <param name="retryOnFailure"></param>
190-
/// <returns></returns>
191167
public static IServiceCollection AddDbContextUseSQLServer<TDbContext>(this IServiceCollection services, string connectionString, int retryOnFailure) where TDbContext : DbContext
192168
{
193169
services.AddDbContextPool<TDbContext>(optionBuilder =>
@@ -214,13 +190,6 @@ public static IServiceCollection AddDbContextUseSQLServer<TDbContext>(this IServ
214190
return services;
215191
}
216192

217-
/// <summary>
218-
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider SQLite
219-
/// </summary>
220-
/// <typeparam name="TDbContext"></typeparam>
221-
/// <param name="services"></param>
222-
/// <param name="connectionString"></param>
223-
/// <returns></returns>
224193
public static IServiceCollection AddDbContextUseSQLite<TDbContext>(this IServiceCollection services, string connectionString) where TDbContext : DbContext
225194
{
226195
services.AddDbContextPool<TDbContext>(optionsBuilder =>
@@ -361,7 +330,8 @@ public static IServiceCollection AddHealthChecksSQLite<TDbContext>(this IService
361330
services.AddHealthChecksUI(setupSettings: setup =>
362331
{
363332
setup.AddHealthCheckEndpoint("Health Check", $"/healthz");
364-
}).AddInMemoryStorage();
333+
})
334+
.AddInMemoryStorage();
365335

366336
return services;
367337
}
@@ -376,7 +346,8 @@ public static IServiceCollection AddHealthChecksSQLServer<TDbContext>(this IServ
376346
services.AddHealthChecksUI(setupSettings: setup =>
377347
{
378348
setup.AddHealthCheckEndpoint("Health Check", $"/healthz");
379-
}).AddInMemoryStorage();
349+
})
350+
.AddInMemoryStorage();
380351

381352
return services;
382353
}
@@ -391,7 +362,8 @@ public static IServiceCollection AddHealthChecksMySQL<TDbContext>(this IServiceC
391362
services.AddHealthChecksUI(setupSettings: setup =>
392363
{
393364
setup.AddHealthCheckEndpoint("Health Check", $"/healthz");
394-
}).AddInMemoryStorage();
365+
})
366+
.AddInMemoryStorage();
395367

396368
return services;
397369
}
@@ -406,7 +378,8 @@ public static IServiceCollection AddHealthChecksPostgreSQL<TDbContext>(this ISer
406378
services.AddHealthChecksUI(setupSettings: setup =>
407379
{
408380
setup.AddHealthCheckEndpoint("Health Check", $"/healthz");
409-
}).AddInMemoryStorage();
381+
})
382+
.AddInMemoryStorage();
410383

411384
return services;
412385
}

src/NET6CustomLibrary/GlobalUsings.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
global using NET6CustomLibrary.EFCore.Core.Interfaces;
4242
global using NET6CustomLibrary.EFCore.Infrastructure.Interfaces;
4343
global using NET6CustomLibrary.EFCore.Infrastructure.Repository;
44-
global using NET6CustomLibrary.EFCoreTransaction.Core;
4544
global using NET6CustomLibrary.EFCoreTransaction.Core.Interfaces;
46-
global using NET6CustomLibrary.EFCoreTransaction.Infrastructure;
4745
global using NET6CustomLibrary.EFCoreTransaction.Infrastructure.Interfaces;
4846
global using NET6CustomLibrary.MailKit.Options;
4947
global using NET6CustomLibrary.MailKit.Services;
@@ -57,4 +55,4 @@
5755
global using RabbitMQ.Client;
5856
global using RabbitMQ.Client.Events;
5957
global using Serilog;
60-
global using Swashbuckle.AspNetCore.SwaggerGen;
58+
global using Swashbuckle.AspNetCore.SwaggerGen;

0 commit comments

Comments
 (0)