//using AyCode.Core.Loggers;
using AyCode.Core.Loggers;
using DevExpress.AspNetCore;
using FruitBank.Common;
using FruitBank.Common.Interfaces;
using FruitBank.Common.Server.Interfaces;
using FruitBank.Common.Server.Services.Loggers;
using FruitBank.Common.Server.Services.SignalRs;
using Mango.Nop.Services;
using Mango.Nop.Services.Loggers;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Domain.Orders;
using Nop.Core.Infrastructure;
using Nop.Data;
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
using Nop.Plugin.Misc.FruitBankPlugin.Factories;
using Nop.Plugin.Misc.FruitBankPlugin.Filters;
using Nop.Plugin.Misc.FruitBankPlugin.Models;
using Nop.Plugin.Misc.FruitBankPlugin.Services;
using Nop.Services.Catalog;
using Nop.Services.Common;
using Nop.Services.Events;
using Nop.Web.Areas.Admin.Factories;
using Nop.Web.Areas.Admin.Models.Catalog;
using Nop.Web.Areas.Admin.Models.Orders;
using System.Net.Http.Headers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Infrastructure;
public class PluginNopStartup : INopStartup
{
///
/// Add and configure any of the middleware
///
/// Collection of service descriptors
/// Configuration of the application
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
services.AddScoped();
services.AddTransient();
services.AddScoped();
services.AddSingleton();
//services.AddSingleton();
services.Configure(options =>
{
options.ViewLocationExpanders.Add(new ViewLocationExpander());
});
services.AddSingleton();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
//services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped, EventConsumer>();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddHttpClient(client =>
{
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "r8_MUApXYIE5mRjxqy20tsGLehWBJkCzNj0Cwvrh");
});
//services.AddScoped();
//services.AddScoped();
//services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
//services.AddScoped();
services.AddScoped();
services.AddControllersWithViews(options =>
{
options.Filters.AddService();
});
services.AddSignalR(hubOptions =>
{
//hubOptions.EnableDetailedErrors = true;
hubOptions.MaximumReceiveMessageSize = 256 * 1024;
hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignalRKeepAliveIntervalSecond);
hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignarlRTimeoutIntervalSecond);
});
}
///
/// Configure the using of added middleware
///
/// Builder for configuring an application's request pipeline
public void Configure(IApplicationBuilder application)
{
var fruitBankHubEndPoint = $"/{FruitBankConstClient.DefaultHubName}";
application.UseWhen(context => context.Request.Path.StartsWithSegments(fruitBankHubEndPoint), app =>
{
app.UseEndpoints(endpoints =>
{
endpoints.MapHub(fruitBankHubEndPoint);
});
});
var loggrHubEndPoint = $"/{FruitBankConstClient.LoggerHubName}";
application.UseWhen(context => context.Request.Path.StartsWithSegments(loggrHubEndPoint), app =>
{
app.UseEndpoints(endpoints =>
{
endpoints.MapHub(loggrHubEndPoint);
});
});
}
///
/// Gets order of this startup configuration implementation
///
public int Order => 4000;
}