58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using Application.Aggregates.Stores;
|
|
using Application.Aggregates.Users;
|
|
using Domain.Aggregates.Stores.Data;
|
|
using Domain.Aggregates.Users.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Persistence;
|
|
using Persistence.Repositories.Aggregates.Stores;
|
|
using Persistence.Repositories.Aggregates.Users;
|
|
using Server.Infrastructure.Extensions.ServiceCollections;
|
|
|
|
namespace Server;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddRazorPages();
|
|
|
|
// Add Settings
|
|
builder.AddConfiguration();
|
|
|
|
// Add Database
|
|
builder.Services.AddDbContext<DatabaseContext>(opt =>
|
|
{
|
|
opt.UseSqlite("Data Source=../../../db/database.db");
|
|
});
|
|
|
|
// Add DI's
|
|
builder.Services.AddScoped<IUserRepository, UserRepository>();
|
|
builder.Services.AddScoped<UsersApplication>();
|
|
|
|
builder.Services.AddScoped<IStoreRepository, StoreRepository>();
|
|
builder.Services.AddScoped<StoresApplication>();
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapStaticAssets();
|
|
app.MapRazorPages()
|
|
.WithStaticAssets();
|
|
|
|
app.Run();
|
|
}
|
|
}
|