Try your search with a different keyword or use * as a wildcard.
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Infrastructure;
using Nop.Web.Framework.Infrastructure.Extensions;
using Nop.Web.Framework.Mvc.Routing;
namespace Nop.Web.Framework.Infrastructure;
///
/// Represents object for the configuring common features and middleware on application startup
///
public partial class NopCommonStartup : INopStartup
{
///
/// Add and configure any of the middleware
///
/// Collection of service descriptors
/// Configuration of the application
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
//add options feature
services.AddOptions();
//add distributed cache
services.AddDistributedCache();
//add HTTP session state feature
services.AddHttpSession();
//add default HTTP clients
services.AddNopHttpClients();
//add anti-forgery
services.AddAntiForgery();
//add theme support
services.AddThemes();
//add routing
services.AddRouting(options =>
{
//add constraint key for language
options.ConstraintMap[NopRoutingDefaults.LanguageParameterTransformer] = typeof(LanguageParameterTransformer);
});
}
///
/// Configure the using of added middleware
///
/// Builder for configuring an application's request pipeline
public void Configure(IApplicationBuilder application)
{
//check whether requested page is keep alive page
application.UseKeepAlive();
//check whether database is installed
application.UseInstallUrl();
//use HTTP session
application.UseSession();
//use request localization
application.UseNopRequestLocalization();
//configure PDF
application.UseNopPdf();
}
///
/// Gets order of this startup configuration implementation
///
public int Order => 100; //common services should be loaded after error handlers
}