Files
taxbaik/TaxBaik.Infrastructure/DependencyInjection.cs
T
kjh2064 7dd51a1169
TaxBaik CI/CD / build-and-deploy (push) Successful in 48s
feat: implement multi-tenant company management system
Architecture:
- Create companies table with company_code as unique identifier
- Add company_id foreign key to admin_users for multi-tenant support
- Implement backward compatibility with DEFAULT company for existing users

Core Components:
- Company entity with full CRUD operations
- ICompanyRepository interface following Repository pattern
- CompanyRepository with Dapper implementation
- CompanyService with business logic and validation
- CompanyController with REST API endpoints

Admin UI:
- CompanyForm reusable component (Create/Edit pattern)
- CompanyList.razor with pagination and company overview
- CompanyCreate.razor for registering new companies
- CompanyEdit.razor for managing existing companies with delete
- All pages follow admin-page-hero pattern for consistency

SOLID Principles:
- Single Responsibility: Each component has one reason to change
- Open/Closed: Extensible without modifying existing code
- Interface Segregation: Clean repository and service contracts
- Dependency Inversion: All layers depend on abstractions

Database Migration (V014):
- Creates companies table with active/inactive status
- Assigns existing admin users to DEFAULT company
- Provides foundation for role-based access control

Future Enhancement:
- Admin users can belong to specific companies
- Data filtering based on company_id (multi-tenant isolation)
- Company-based permission model
2026-06-28 16:52:22 +09:00

28 lines
1.2 KiB
C#

namespace TaxBaik.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using TaxBaik.Domain.Interfaces;
using TaxBaik.Infrastructure.Data;
using TaxBaik.Infrastructure.Repositories;
public static class DependencyInjection
{
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
{
services.AddSingleton<IDbConnectionFactory, DbConnectionFactory>();
services.AddScoped<IAdminUserRepository, AdminUserRepository>();
services.AddScoped<ICategoryRepository, CategoryRepository>();
services.AddScoped<IBlogPostRepository, BlogPostRepository>();
services.AddScoped<IInquiryRepository, InquiryRepository>();
services.AddScoped<ISiteSettingRepository, SiteSettingRepository>();
services.AddScoped<IAnnouncementRepository, AnnouncementRepository>();
services.AddScoped<IClientRepository, ClientRepository>();
services.AddScoped<IFaqRepository, FaqRepository>();
services.AddScoped<IConsultationRepository, ConsultationRepository>();
services.AddScoped<ITaxFilingRepository, TaxFilingRepository>();
services.AddScoped<ICompanyRepository, CompanyRepository>();
return services;
}
}