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

Commit 4b9ca80

Browse files
committed
Aggiunta opzione MigrationsAssembly per DBContext SQL Server
1 parent 20e48c6 commit 4b9ca80

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/NET6CustomLibrary/Extensions/DependencyInjection.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,19 @@ public static IServiceCollection AddDbContextUseSQLServer<TDbContext>(this IServ
176176
{
177177
optionBuilder.UseSqlServer(connectionString, options =>
178178
{
179+
options.MigrationsAssembly(typeof(TDbContext).Assembly.FullName);
180+
179181
// Abilito il connection resiliency (Provider di SQL Server è soggetto a errori transienti)
180182
// Info su: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
181183
options.EnableRetryOnFailure(retryOnFailure);
182184
});
183185
}
184186
else
185187
{
186-
optionBuilder.UseSqlServer(connectionString);
188+
optionBuilder.UseSqlServer(connectionString, options =>
189+
{
190+
options.MigrationsAssembly(typeof(TDbContext).Assembly.FullName);
191+
});
187192
}
188193
});
189194
return services;

0 commit comments

Comments
 (0)