//using AyCode.Core.Loggers;
using AyCode.Core.Loggers;
using DevExpress.AspNetCore;
using FruitBank.Common;
using FruitBank.Common.Interfaces;
using FruitBank.Common.Server.Services.Loggers;
using FruitBank.Common.Server.Services.SignalRs;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Services;
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.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 FruitBank.Common.Server.Interfaces;
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
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.Configure(options =>
{
options.ViewLocationExpanders.Add(new ViewLocationExpander());
});
//register services and interfaces
services.AddSingleton();
services.AddScoped();
//services.AddScoped();
services.AddScoped();
//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, EventConsumer>();
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.AddControllersWithViews(options =>
{
options.Filters.AddService();
});
services.AddSignalR(options => options.MaximumReceiveMessageSize = 256 * 1024);
}
///
/// 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;
}