77 lines
2.7 KiB
C#
77 lines
2.7 KiB
C#
using ComputerStoreBusinessLogic.BusinessLogic;
|
|
using ComputerStoreBusinessLogic.OfficePackage;
|
|
using ComputerStoreBusinessLogic.OfficePackage.Implements;
|
|
using ComputerStoreContracts.BusinessLogicContracts;
|
|
using ComputerStoreContracts.StorageContracts;
|
|
using ComputerStoreDatabaseImplement.Implements;
|
|
using Newtonsoft.Json.Serialization;
|
|
using System.Reflection;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllersWithViews().AddNewtonsoftJson(options =>
|
|
{
|
|
options.SerializerSettings.ContractResolver = new DefaultContractResolver {
|
|
DefaultMembersSearchFlags = BindingFlags.Public |
|
|
BindingFlags.NonPublic |
|
|
BindingFlags.Instance |
|
|
BindingFlags.DeclaredOnly |
|
|
BindingFlags.GetField
|
|
};
|
|
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
|
});
|
|
builder.Services.AddDistributedMemoryCache();
|
|
builder.Services.AddSession();
|
|
|
|
builder.Services.AddScoped<ISellerStorage, SellerStorage>();
|
|
builder.Services.AddScoped<IOrderStorage, OrderStorage>();
|
|
builder.Services.AddScoped<IConsignmentStorage, ConsignmentStorage>();
|
|
builder.Services.AddScoped<IRequestStorage, RequestStorage>();
|
|
|
|
builder.Services.AddScoped<IRequestComponentStorage, RequestComponentStorage>();
|
|
|
|
builder.Services.AddScoped<IEmployeeStorage, EmployeeStorage>();
|
|
builder.Services.AddScoped<IComponentStorage, ComponentStorage>();
|
|
builder.Services.AddScoped<IPCStorage, PCStorage>();
|
|
builder.Services.AddScoped<IProductStorage, ProductStorage>();
|
|
|
|
builder.Services.AddScoped<ISellerLogic, SellerLogic>();
|
|
builder.Services.AddScoped<IOrderLogic, OrderLogic>();
|
|
builder.Services.AddScoped<IConsignmentLogic, ConsignmentLogic>();
|
|
builder.Services.AddScoped<IRequestLogic, RequestLogic>();
|
|
|
|
builder.Services.AddScoped<IRequestComponentLogic, RequestComponentLogic>();
|
|
|
|
builder.Services.AddScoped<IEmployeeLogic, EmployeeLogic>();
|
|
builder.Services.AddScoped<IComponentLogic, ComponentLogic>();
|
|
builder.Services.AddScoped<IPCLogic, PCLogic>();
|
|
builder.Services.AddScoped<IProductLogic, ProductLogic>();
|
|
|
|
builder.Services.AddMvc();
|
|
builder.Services.AddHttpContextAccessor();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
app.UseSession();
|
|
|
|
app.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}");
|
|
|
|
app.Run();
|