diff --git a/src/ReC.API/Program.cs b/src/ReC.API/Program.cs index 48863a6..fd0091a 100644 --- a/src/ReC.API/Program.cs +++ b/src/ReC.API/Program.cs @@ -1,6 +1,18 @@ +using Microsoft.EntityFrameworkCore; +using ReC.Infrastructure; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. +builder.Services.AddInfrastructureServices(options => +{ + options.ConfigureDbContext((dbContextOpt) => + { + var connectionString = builder.Configuration.GetConnectionString("Default") + ?? throw new InvalidOperationException("Connection string is not found."); + dbContextOpt.UseSqlServer(connectionString); + }); +}); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle diff --git a/src/ReC.API/ReC.API.csproj b/src/ReC.API/ReC.API.csproj index 5419ef0..9145bb5 100644 --- a/src/ReC.API/ReC.API.csproj +++ b/src/ReC.API/ReC.API.csproj @@ -7,7 +7,12 @@ + + + + +