Introduce MassData feature with new API endpoints for querying and upserting records by customer name. Add DTOs, AutoMapper profile, MediatR CQRS handlers, repository pattern, and MassDataDbContext. Register new services in DI and add MassDataConnection to configuration. Upsert uses stored procedure. Enables full CRUD for Massdata via dedicated API.
21 lines
769 B
C#
21 lines
769 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace DbFirst.Infrastructure;
|
|
|
|
public static class DependencyInjection
|
|
{
|
|
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
services.Configure<TableConfigurations>(configuration.GetSection("TableConfigurations"));
|
|
services.AddDbContext<ApplicationDbContext>(options =>
|
|
options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
|
|
|
|
services.AddDbContext<MassDataDbContext>(options =>
|
|
options.UseSqlServer(configuration.GetConnectionString("MassDataConnection")));
|
|
|
|
return services;
|
|
}
|
|
}
|