37 lines
1.7 KiB
C#
37 lines
1.7 KiB
C#
using FaKrosnoEfDataModel;
|
|
using FaKrosnoEfDataModel.Services;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using SytelineSaAppEfDataModel;
|
|
using SytelineSaAppEfDataModel.Services;
|
|
using FaKrosnoMappingProfile = FaKrosnoEfDataModel.MappingProfile;
|
|
using SytelineSaAppMappingProfile = SytelineSaAppEfDataModel.MappingProfile;
|
|
|
|
namespace BroseCumulativeReport;
|
|
|
|
public class Service
|
|
{
|
|
public IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
|
{
|
|
config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
|
})
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
var configuration = hostContext.Configuration;
|
|
var sytelineConnection = configuration.GetConnectionString("SytelineSaAppConnection");
|
|
var faKrosnoConnection = configuration.GetConnectionString("FaKrosnoConnection");
|
|
|
|
services.AddDbContext<SytelineSaAppDbContext>(options => options.UseSqlServer(sytelineConnection));
|
|
services.AddDbContext<FaKrosnoDbContext>(options => options.UseSqlServer(faKrosnoConnection));
|
|
|
|
services.AddAutoMapper(typeof(FaKrosnoMappingProfile), typeof(SytelineSaAppMappingProfile));
|
|
|
|
services.AddScoped<IScheduleOrderService, ScheduleOrderService>();
|
|
services.AddScoped<IMaterialTransactionService, MaterialTransactionService>();
|
|
services.AddScoped<IApp, App>();
|
|
});
|
|
} |