Merge branch 'main' of http://git.dd:3000/AppStd/DbFirst
This commit is contained in:
@@ -4,6 +4,8 @@ using DbFirst.Infrastructure;
|
||||
using DbFirst.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
//TODO: create and add exception handling middleware
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
@@ -11,6 +13,7 @@ builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
// TODO: allow listed origins configured in appsettings.json
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(policy =>
|
||||
@@ -21,9 +24,11 @@ builder.Services.AddCors(options =>
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: Create extension method for this in Infrastructure layer in case of using in multiple projects
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||||
|
||||
// TODO: Create extension method for this in Application layer in case of using in multiple projects
|
||||
builder.Services.AddAutoMapper(typeof(CatalogProfile).Assembly, typeof(ApplicationDbContext).Assembly);
|
||||
|
||||
builder.Services.AddScoped<ICatalogRepository, CatalogRepository>();
|
||||
|
||||
Reference in New Issue
Block a user