initial commit

This commit is contained in:
2026-07-21 14:14:44 +07:00
commit fa7dbb970d
1359 changed files with 104110 additions and 0 deletions
@@ -0,0 +1,23 @@
namespace Indotalent.Infrastructure.Database.MsSQL;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
public static class MsSQLConfiguration
{
public static IServiceCollection AddMsSQLContext<TContext>(this IServiceCollection services, string connectionString)
where TContext : DbContext
{
services.AddDbContext<TContext>(options =>
options.UseSqlServer(connectionString, m =>
m.MigrationsAssembly(typeof(TContext).Assembly.FullName)));
return services;
}
public static void InitializeDatabase<TContext>(IServiceProvider serviceProvider) where TContext : DbContext
{
using var scope = serviceProvider.CreateScope();
var context = scope.ServiceProvider.GetRequiredService<TContext>();
context.Database.EnsureCreated();
}
}