Try your search with a different keyword or use * as a wildcard.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Core.Infrastructure;
using Nop.Data;
using Nop.Services.Affiliates;
using Nop.Services.Attributes;
using Nop.Services.Authentication;
using Nop.Services.Authentication.External;
using Nop.Services.Authentication.MultiFactor;
using Nop.Services.Blogs;
using Nop.Services.Caching;
using Nop.Services.Catalog;
using Nop.Services.Cms;
using Nop.Services.Common;
using Nop.Services.Configuration;
using Nop.Services.Customers;
using Nop.Services.Directory;
using Nop.Services.Discounts;
using Nop.Services.Events;
using Nop.Services.ExportImport;
using Nop.Services.Forums;
using Nop.Services.Gdpr;
using Nop.Services.Helpers;
using Nop.Services.Html;
using Nop.Services.Installation;
using Nop.Services.Localization;
using Nop.Services.Logging;
using Nop.Services.Media;
using Nop.Services.Media.RoxyFileman;
using Nop.Services.Messages;
using Nop.Services.News;
using Nop.Services.Orders;
using Nop.Services.Payments;
using Nop.Services.Plugins;
using Nop.Services.Plugins.Marketplace;
using Nop.Services.Polls;
using Nop.Services.ScheduleTasks;
using Nop.Services.Security;
using Nop.Services.Seo;
using Nop.Services.Shipping;
using Nop.Services.Shipping.Date;
using Nop.Services.Shipping.Pickup;
using Nop.Services.Stores;
using Nop.Services.Tax;
using Nop.Services.Themes;
using Nop.Services.Topics;
using Nop.Services.Vendors;
using Nop.Web.Framework.Factories;
using Nop.Web.Framework.Menu;
using Nop.Web.Framework.Mvc.Routing;
using Nop.Web.Framework.Themes;
using Nop.Web.Framework.UI;
using TaskScheduler = Nop.Services.ScheduleTasks.TaskScheduler;
namespace Nop.Web.Framework.Infrastructure;
///
/// Represents the registering services on application startup
///
public partial class NopStartup : INopStartup
{
///
/// Add and configure any of the middleware
///
/// Collection of service descriptors
/// Configuration of the application
public virtual void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
//file provider
services.AddScoped();
//web helper
services.AddScoped();
//user agent helper
services.AddScoped();
//plugins
services.AddScoped();
services.AddScoped();
//static cache manager
var appSettings = Singleton.Instance;
var distributedCacheConfig = appSettings.Get();
services.AddTransient(typeof(IConcurrentCollection<>), typeof(ConcurrentTrie<>));
services.AddSingleton();
services.AddScoped();
if (distributedCacheConfig.Enabled)
{
switch (distributedCacheConfig.DistributedCacheType)
{
case DistributedCacheType.Memory:
services.AddScoped();
services.AddScoped();
break;
case DistributedCacheType.SqlServer:
services.AddScoped();
services.AddScoped();
break;
case DistributedCacheType.Redis:
services.AddSingleton();
services.AddScoped();
services.AddScoped();
break;
case DistributedCacheType.RedisSynchronizedMemory:
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddScoped();
break;
}
services.AddSingleton();
}
else
{
services.AddSingleton();
services.AddSingleton();
services.AddScoped();
}
//work context
services.AddScoped();
//store context
services.AddScoped();
//services
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();
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();
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();
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();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddSingleton();
services.AddScoped();
services.AddSingleton();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
//attribute services
services.AddScoped(typeof(IAttributeService<,>), typeof(AttributeService<,>));
//attribute parsers
services.AddScoped(typeof(IAttributeParser<,>), typeof(Services.Attributes.AttributeParser<,>));
//attribute formatter
services.AddScoped(typeof(IAttributeFormatter<,>), typeof(AttributeFormatter<,>));
//plugin managers
services.AddScoped(typeof(IPluginManager<>), typeof(PluginManager<>));
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddSingleton();
//register all settings
var typeFinder = Singleton.Instance;
var settings = typeFinder.FindClassesOfType(typeof(ISettings), false).ToList();
foreach (var setting in settings)
{
services.AddScoped(setting, serviceProvider =>
{
var storeId = DataSettingsManager.IsDatabaseInstalled()
? serviceProvider.GetRequiredService().GetCurrentStore()?.Id ?? 0
: 0;
return serviceProvider.GetRequiredService().LoadSettingAsync(setting, storeId).Result;
});
}
//picture service
if (appSettings.Get().Enabled)
services.AddScoped();
else
services.AddScoped();
//roxy file manager
services.AddScoped();
services.AddScoped();
//installation service
services.AddScoped();
//slug route transformer
if (DataSettingsManager.IsDatabaseInstalled())
services.AddScoped();
//schedule tasks
services.AddSingleton();
services.AddTransient();
//event consumers
var consumers = typeFinder.FindClassesOfType(typeof(IConsumer<>)).ToList();
foreach (var consumer in consumers)
foreach (var findInterface in consumer.FindInterfaces((type, criteria) =>
{
var isMatch = type.IsGenericType && ((Type)criteria).IsAssignableFrom(type.GetGenericTypeDefinition());
return isMatch;
}, typeof(IConsumer<>)))
services.AddScoped(findInterface, consumer);
//XML sitemap
services.AddScoped();
//register the Lazy resolver for .Net IoC
var useAutofac = appSettings.Get().UseAutofac;
if (!useAutofac)
services.AddScoped(typeof(Lazy<>), typeof(LazyInstance<>));
}
///
/// Configure the using of added middleware
///
/// Builder for configuring an application's request pipeline
public void Configure(IApplicationBuilder application)
{
}
///
/// Gets order of this startup configuration implementation
///
public int Order => 2000;
}