Implement Inventory Management Service with CRUD operations for warehouses and inventory items, stock operations, and bulk processing capabilities.
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using CMSMicroservice.Application.Common.Interfaces;
|
||||
using CMSMicroservice.Application.Common.Interfaces.Repositories;
|
||||
using CMSMicroservice.Infrastructure.Persistence;
|
||||
using CMSMicroservice.Infrastructure.Persistence.Repositories;
|
||||
using CMSMicroservice.Infrastructure.Services;
|
||||
|
||||
namespace CMSMicroservice.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// کلاس تزریق وابستگی برای لایه Infrastructure
|
||||
/// </summary>
|
||||
public static class DependencyInjection
|
||||
{
|
||||
/// <summary>
|
||||
/// افزودن سرویس های Infrastructure به DI Container
|
||||
/// </summary>
|
||||
/// <param name="services">IServiceCollection</param>
|
||||
/// <param name="configuration">IConfiguration</param>
|
||||
/// <returns>IServiceCollection</returns>
|
||||
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
// Database Configuration
|
||||
services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseSqlServer(
|
||||
configuration.GetConnectionString("DefaultConnection"),
|
||||
b => b.MigrationsAssembly(typeof(ApplicationDbContext).Assembly.FullName)));
|
||||
|
||||
// Application Context Interface
|
||||
services.AddScoped<IApplicationDbContext>(provider => provider.GetRequiredService<ApplicationDbContext>());
|
||||
|
||||
// Repository Pattern Registration
|
||||
services.AddScoped<IInventoryItemRepository, InventoryItemRepository>();
|
||||
services.AddScoped<IStockMovementRepository, StockMovementRepository>();
|
||||
services.AddScoped<IWarehouseRepository, WarehouseRepository>();
|
||||
|
||||
// Business Services
|
||||
services.AddScoped<IInventoryService, InventoryService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user