58 lines
2.1 KiB
C#
58 lines
2.1 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Mvc.Razor;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Nop.Core.Infrastructure;
|
|
using Nop.Plugin.Misc.SignalRApi.Hubs;
|
|
using Nop.Plugin.Misc.SignalRApi.Services;
|
|
using Nop.Services.Customers;
|
|
using Nop.Services.Localization;
|
|
|
|
namespace Nop.Plugin.Misc.SignalRApi.Infrastructure
|
|
{
|
|
public class PluginNopStartup : INopStartup
|
|
{
|
|
/// <summary>
|
|
/// Add and configure any of the middleware
|
|
/// </summary>
|
|
/// <param name="services">Collection of service descriptors</param>
|
|
/// <param name="configuration">Configuration of the application</param>
|
|
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
services.Configure<RazorViewEngineOptions>(options =>
|
|
{
|
|
options.ViewLocationExpanders.Add(new ViewLocationExpander());
|
|
});
|
|
|
|
//register services and interfaces
|
|
//services.AddScoped<CustomModelFactory, ICustomerModelFactory>();
|
|
services.AddSignalR();
|
|
services.AddScoped<SignalRservice>();
|
|
services.AddScoped<CustomerService>();
|
|
services.AddScoped<CustomerRegistrationService>();
|
|
services.AddScoped<LocalizationService>();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Configure the using of added middleware
|
|
/// </summary>
|
|
/// <param name="application">Builder for configuring an application's request pipeline</param>
|
|
public void Configure(IApplicationBuilder application)
|
|
{
|
|
//application.UseEndpoints(endpoints =>
|
|
//{
|
|
// endpoints.MapHub<MainHub>("/mainHub");
|
|
//});
|
|
//application.UseCors(options => {
|
|
// options.AllowAnyMethod().AllowAnyHeader().AllowCredentials().SetIsOriginAllowed((hosts) => true);
|
|
//});
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets order of this startup configuration implementation
|
|
/// </summary>
|
|
public int Order => 3000;
|
|
}
|
|
} |