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

Commit 244f2a5

Browse files
committed
WIP: Aggiunta documentazione extension method
1 parent 77107f1 commit 244f2a5

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/NET6CustomLibrary/Extensions/DependencyInjection.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ public static IServiceCollection AddDbContextGenericsMethods<TDbContext>(this IS
101101
return services;
102102
}
103103

104+
/// <summary>
105+
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider MySQL / MariaDB
106+
/// </summary>
107+
/// <typeparam name="TDbContext"></typeparam>
108+
/// <param name="services"></param>
109+
/// <param name="connectionString"></param>
110+
/// <param name="retryOnFailure"></param>
111+
/// <returns></returns>
104112
public static IServiceCollection AddDbContextUseMySql<TDbContext>(this IServiceCollection services, string connectionString, int retryOnFailure) where TDbContext : DbContext
105113
{
106114
services.AddDbContextPool<TDbContext>(optionBuilder =>
@@ -122,6 +130,14 @@ public static IServiceCollection AddDbContextUseMySql<TDbContext>(this IServiceC
122130
return services;
123131
}
124132

133+
/// <summary>
134+
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider Postgres
135+
/// </summary>
136+
/// <typeparam name="TDbContext"></typeparam>
137+
/// <param name="services"></param>
138+
/// <param name="connectionString"></param>
139+
/// <param name="retryOnFailure"></param>
140+
/// <returns></returns>
125141
public static IServiceCollection AddDbContextUsePostgres<TDbContext>(this IServiceCollection services, string connectionString, int retryOnFailure) where TDbContext : DbContext
126142
{
127143
services.AddDbContextPool<TDbContext>(optionBuilder =>
@@ -144,6 +160,14 @@ public static IServiceCollection AddDbContextUsePostgres<TDbContext>(this IServi
144160
return services;
145161
}
146162

163+
/// <summary>
164+
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider SQL Server
165+
/// </summary>
166+
/// <typeparam name="TDbContext"></typeparam>
167+
/// <param name="services"></param>
168+
/// <param name="connectionString"></param>
169+
/// <param name="retryOnFailure"></param>
170+
/// <returns></returns>
147171
public static IServiceCollection AddDbContextUseSQLServer<TDbContext>(this IServiceCollection services, string connectionString, int retryOnFailure) where TDbContext : DbContext
148172
{
149173
services.AddDbContextPool<TDbContext>(optionBuilder =>
@@ -162,10 +186,16 @@ public static IServiceCollection AddDbContextUseSQLServer<TDbContext>(this IServ
162186
optionBuilder.UseSqlServer(connectionString);
163187
}
164188
});
165-
166189
return services;
167190
}
168191

192+
/// <summary>
193+
/// Extension method per aggiungere un DbContext di tipo TDbContext con il provider SQLite
194+
/// </summary>
195+
/// <typeparam name="TDbContext"></typeparam>
196+
/// <param name="services"></param>
197+
/// <param name="connectionString"></param>
198+
/// <returns></returns>
169199
public static IServiceCollection AddDbContextUseSQLite<TDbContext>(this IServiceCollection services, string connectionString) where TDbContext : DbContext
170200
{
171201
services.AddDbContextPool<TDbContext>(optionsBuilder =>

0 commit comments

Comments
 (0)