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

Commit 66b5a30

Browse files
committed
Aggiunto metodo AddDbContextUseSQLite
1 parent 0ac601f commit 66b5a30

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/NET6CustomLibrary/Extensions/DependencyInjection.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ public static IServiceCollection AddDbContextUsePostgres<TDbContext>(this IServi
144144
return services;
145145
}
146146

147+
public static IServiceCollection AddDbContextUseSQLite<TDbContext>(this IServiceCollection services, string connectionString) where TDbContext : DbContext
148+
{
149+
services.AddDbContextPool<TDbContext>(optionsBuilder =>
150+
{
151+
optionsBuilder.UseSqlite(connectionString, options =>
152+
{
153+
// Non abilito il connection resiliency, non è supportato dal provider di Sqlite in quanto non soggetto a errori transienti)
154+
});
155+
});
156+
157+
return services;
158+
}
159+
147160
#endregion
148161

149162
#region "HEALTH CHECKS"

0 commit comments

Comments
 (0)