Add project

This commit is contained in:
aloslider
2026-07-06 09:32:44 +03:00
parent 2ff2bb67f2
commit 1af22c39db
29 changed files with 1048 additions and 0 deletions
@@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore;
using Web.Data;
using Web.Services;
namespace Web.Extensions;
internal static class IServiceCollectionExtensions
{
public static IServiceCollection AddInternalServices(this IServiceCollection services)
{
services.AddScoped<IOrdersService, OrdersService>();
return services;
}
public static IServiceCollection AddDbAccess(this IServiceCollection services, IConfiguration configuration)
{
string connectionString = configuration.GetConnectionString("DbContext")
?? throw new InvalidOperationException("DB connection string is not set");
services.AddDbContext<AppDbContext>(opts => opts.UseNpgsql(connectionString));
return services;
}
}