740 lines
35 KiB
C#
740 lines
35 KiB
C#
using AyCode.Core.Loggers;
|
||
using FluentValidation;
|
||
using FluentValidation.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 Mango.Sandbox.EndPoints.Services;
|
||
using Microsoft.AspNetCore.Http.Connections;
|
||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||
using Nop.Core;
|
||
using Nop.Core.Caching;
|
||
using Nop.Core.Configuration;
|
||
using Nop.Core.Domain;
|
||
using Nop.Core.Domain.Blogs;
|
||
using Nop.Core.Domain.Catalog;
|
||
using Nop.Core.Domain.Common;
|
||
using Nop.Core.Domain.Customers;
|
||
using Nop.Core.Domain.Directory;
|
||
using Nop.Core.Domain.Forums;
|
||
using Nop.Core.Domain.Gdpr;
|
||
using Nop.Core.Domain.Localization;
|
||
using Nop.Core.Domain.Media;
|
||
using Nop.Core.Domain.Messages;
|
||
using Nop.Core.Domain.News;
|
||
using Nop.Core.Domain.Orders;
|
||
using Nop.Core.Domain.Payments;
|
||
using Nop.Core.Domain.Security;
|
||
using Nop.Core.Domain.Seo;
|
||
using Nop.Core.Domain.Shipping;
|
||
using Nop.Core.Domain.Stores;
|
||
using Nop.Core.Domain.Tax;
|
||
using Nop.Core.Domain.Vendors;
|
||
using Nop.Core.Events;
|
||
using Nop.Core.Http;
|
||
using Nop.Core.Infrastructure;
|
||
using Nop.Core.Security;
|
||
using Nop.Data;
|
||
using Nop.Data.DataProviders;
|
||
using Nop.Data.Mapping;
|
||
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.Mapping;
|
||
using Nop.Plugin.Misc.FruitBankPlugin.Services;
|
||
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.Areas.Admin.Factories;
|
||
using Nop.Web.Areas.Admin.Helpers;
|
||
using Nop.Web.Framework;
|
||
using Nop.Web.Framework.Factories;
|
||
using Nop.Web.Framework.Infrastructure;
|
||
using Nop.Web.Framework.Menu;
|
||
using Nop.Web.Framework.Mvc.Routing;
|
||
using Nop.Web.Framework.Themes;
|
||
using Nop.Web.Framework.UI;
|
||
using Nop.Web.Infrastructure.Installation;
|
||
using System.Net.Http.Headers;
|
||
|
||
var builder = WebApplication.CreateBuilder(args);
|
||
|
||
// ===========================================
|
||
// === KONFIGUR<55>CI<43> ===
|
||
// ===========================================
|
||
|
||
var prodAppSettingsPath = Path.GetFullPath(Path.Combine(
|
||
builder.Environment.ContentRootPath,
|
||
"..", "..", "..",
|
||
"Presentation", "Nop.Web", "App_Data", "appsettings.json"));
|
||
|
||
if (File.Exists(prodAppSettingsPath))
|
||
{
|
||
builder.Configuration.AddJsonFile(prodAppSettingsPath, optional: false, reloadOnChange: true);
|
||
Console.WriteLine($"[SANDBOX] PROD config loaded: {prodAppSettingsPath}");
|
||
}
|
||
else
|
||
{
|
||
Console.WriteLine($"[SANDBOX] WARNING: PROD appsettings.json not found at: {prodAppSettingsPath}");
|
||
}
|
||
|
||
builder.Configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||
Console.WriteLine("[SANDBOX] SANDBOX config overrides applied");
|
||
|
||
// ===========================================
|
||
// === NAME COMPATIBILITY - LinqToDB t<>bla mapping ===
|
||
// ===========================================
|
||
|
||
NameCompatibilityManager.AdditionalNameCompatibilities.Add(typeof(NameCompatibility));
|
||
Console.WriteLine("[SANDBOX] FruitBank NameCompatibility registered for LinqToDB table mapping");
|
||
|
||
// ===========================================
|
||
// === FILE PROVIDER (STATIC) ===
|
||
// ===========================================
|
||
|
||
CommonHelper.DefaultFileProvider = new NopFileProvider(builder.Environment);
|
||
|
||
// ===========================================
|
||
// === TYPE FINDER ===
|
||
// ===========================================
|
||
|
||
var typeFinder = new WebAppTypeFinder();
|
||
Singleton<ITypeFinder>.Instance = typeFinder;
|
||
builder.Services.AddSingleton<ITypeFinder>(typeFinder);
|
||
Console.WriteLine("[SANDBOX] TypeFinder registered");
|
||
|
||
// ===========================================
|
||
// === ENGINE ===
|
||
// ===========================================
|
||
|
||
var engine = new NopEngine();
|
||
Singleton<IEngine>.Instance = engine;
|
||
builder.Services.AddSingleton<IEngine>(engine);
|
||
Console.WriteLine("[SANDBOX] NopEngine registered");
|
||
|
||
// ===========================================
|
||
// === CORS ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddCors(options =>
|
||
{
|
||
options.AddDefaultPolicy(policy =>
|
||
{
|
||
policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
|
||
});
|
||
|
||
options.AddPolicy("SignalR", policy =>
|
||
{
|
||
policy.SetIsOriginAllowed(_ => true).AllowAnyMethod().AllowAnyHeader().AllowCredentials();
|
||
});
|
||
});
|
||
|
||
// ===========================================
|
||
// === DI VALID<49>CI<43> KIKAPCSOL<4F>SA ===
|
||
// ===========================================
|
||
|
||
builder.Host.UseDefaultServiceProvider(options =>
|
||
{
|
||
options.ValidateScopes = false;
|
||
options.ValidateOnBuild = false;
|
||
});
|
||
|
||
// ===========================================
|
||
// === MVC INFRASTRUKT<4B>RA ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddControllersWithViews();
|
||
builder.Services.AddRazorPages();
|
||
builder.Services.AddSession();
|
||
|
||
// ===========================================
|
||
// === ALAPVET<45> INFRASTRUKT<4B>RA ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddHttpContextAccessor();
|
||
builder.Services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
|
||
builder.Services.AddMemoryCache();
|
||
|
||
// ===========================================
|
||
// === APP SETTINGS ===
|
||
// ===========================================
|
||
|
||
var appSettings = new AppSettings();
|
||
builder.Configuration.Bind(appSettings);
|
||
builder.Services.AddSingleton(appSettings);
|
||
Singleton<AppSettings>.Instance = appSettings;
|
||
|
||
// ===========================================
|
||
// === FILE PROVIDER (DI) ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<INopFileProvider, NopFileProvider>();
|
||
|
||
// ===========================================
|
||
// === ADATB<54>ZIS <20>S REPOSITORY ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<INopDataProvider, MsSqlNopDataProvider>();
|
||
builder.Services.AddScoped(typeof(IRepository<>), typeof(EntityRepository<>));
|
||
|
||
// ===========================================
|
||
// === CACHE SZOLG<4C>LTAT<41>SOK ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddTransient(typeof(IConcurrentCollection<>), typeof(ConcurrentTrie<>));
|
||
builder.Services.AddSingleton<ICacheKeyManager, CacheKeyManager>();
|
||
builder.Services.AddScoped<IShortTermCacheManager, PerRequestCacheManager>();
|
||
builder.Services.AddSingleton<ILocker, MemoryCacheLocker>();
|
||
builder.Services.AddSingleton<IStaticCacheManager, MemoryCacheManager>();
|
||
builder.Services.AddScoped<ICacheKeyService, MemoryCacheManager>();
|
||
|
||
// ===========================================
|
||
// === EVENT PUBLISHER ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddSingleton<IEventPublisher, EventPublisher>();
|
||
|
||
// ===========================================
|
||
// === LAZY WRAPPERS ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped(typeof(Lazy<>), typeof(LazyInstance<>));
|
||
|
||
// ===========================================
|
||
// === NOP SETTINGS (Domain Settings) - DINAMIKUS REGISZTR<54>CI<43> ===
|
||
// ===========================================
|
||
|
||
// Alapvet<65> Settings-ek fix <20>rt<72>kekkel (amik a SANDBOX m<>k<EFBFBD>d<EFBFBD>s<EFBFBD>hez sz<73>ks<6B>gesek)
|
||
builder.Services.AddScoped(sp => new CookieSettings());
|
||
builder.Services.AddScoped(sp => new CurrencySettings { PrimaryStoreCurrencyId = 1 });
|
||
builder.Services.AddScoped(sp => new LocalizationSettings { DefaultAdminLanguageId = 1, AutomaticallyDetectLanguage = false });
|
||
builder.Services.AddScoped(sp => new TaxSettings { TaxDisplayType = TaxDisplayType.IncludingTax });
|
||
builder.Services.AddScoped(sp => new CatalogSettings());
|
||
builder.Services.AddScoped(sp => new OrderSettings());
|
||
builder.Services.AddScoped(sp => new ShippingSettings());
|
||
builder.Services.AddScoped(sp => new RewardPointsSettings());
|
||
builder.Services.AddScoped(sp => new CustomerSettings());
|
||
builder.Services.AddScoped(sp => new CommonSettings());
|
||
builder.Services.AddScoped(sp => new ShoppingCartSettings());
|
||
builder.Services.AddScoped(sp => new MediaSettings());
|
||
builder.Services.AddScoped(sp => new StoreInformationSettings());
|
||
builder.Services.AddScoped(sp => new SeoSettings());
|
||
builder.Services.AddScoped(sp => new SecuritySettings());
|
||
builder.Services.AddScoped(sp => new AdminAreaSettings());
|
||
builder.Services.AddScoped(sp => new EmailAccountSettings());
|
||
builder.Services.AddScoped(sp => new MessagesSettings());
|
||
builder.Services.AddScoped(sp => new ExternalAuthenticationSettings());
|
||
builder.Services.AddScoped(sp => new VendorSettings());
|
||
builder.Services.AddScoped(sp => new BlogSettings());
|
||
builder.Services.AddScoped(sp => new NewsSettings());
|
||
builder.Services.AddScoped(sp => new ForumSettings());
|
||
builder.Services.AddScoped(sp => new GdprSettings());
|
||
builder.Services.AddScoped(sp => new PaymentSettings());
|
||
builder.Services.AddScoped(sp => new AddressSettings());
|
||
builder.Services.AddScoped(sp => new DateTimeSettings());
|
||
builder.Services.AddScoped(sp => new CaptchaSettings());
|
||
builder.Services.AddScoped(sp => new DisplayDefaultMenuItemSettings());
|
||
builder.Services.AddScoped(sp => new DisplayDefaultFooterItemSettings());
|
||
builder.Services.AddScoped(sp => new PdfSettings());
|
||
builder.Services.AddScoped(sp => new RobotsTxtSettings());
|
||
builder.Services.AddScoped(sp => new SitemapSettings());
|
||
builder.Services.AddScoped(sp => new SitemapXmlSettings());
|
||
builder.Services.AddScoped(sp => new MeasureSettings());
|
||
builder.Services.AddScoped(sp => new MultiFactorAuthenticationSettings());
|
||
builder.Services.AddScoped(sp => new ProxySettings());
|
||
|
||
// Tov<6F>bbi Settings-ek (Nop.Core.Domain namespace-ekb<6B>l)
|
||
builder.Services.AddScoped(sp => new Nop.Core.Domain.Catalog.ProductEditorSettings());
|
||
builder.Services.AddScoped(sp => new Nop.Core.Domain.Messages.MessageTemplatesSettings());
|
||
|
||
// ===========================================
|
||
// === NOP CORE SZOLG<4C>LTAT<41>SOK ===
|
||
// ===========================================
|
||
|
||
// Web & Utils
|
||
builder.Services.AddScoped<IWebHelper, WebHelper>();
|
||
builder.Services.AddScoped<IUserAgentHelper, UserAgentHelper>();
|
||
builder.Services.AddScoped<IDateTimeHelper, DateTimeHelper>();
|
||
|
||
// Context
|
||
builder.Services.AddScoped<IWorkContext, WebWorkContext>();
|
||
builder.Services.AddScoped<IStoreContext, WebStoreContext>();
|
||
|
||
// Plugins
|
||
builder.Services.AddScoped<IPluginService, PluginService>();
|
||
builder.Services.AddScoped<OfficialFeedManager>();
|
||
|
||
// Settings & Config
|
||
builder.Services.AddScoped<ISettingService, SettingService>();
|
||
|
||
// Security & Permission
|
||
builder.Services.AddScoped<IPermissionService, PermissionService>();
|
||
builder.Services.AddScoped<IAclService, AclService>();
|
||
builder.Services.AddScoped<IEncryptionService, EncryptionService>();
|
||
|
||
// Authentication
|
||
builder.Services.AddScoped<IAuthenticationService, CookieAuthenticationService>();
|
||
builder.Services.AddScoped<IExternalAuthenticationService, NullExternalAuthenticationService>();
|
||
|
||
// Store
|
||
builder.Services.AddScoped<IStoreService, StoreService>();
|
||
builder.Services.AddScoped<IStoreMappingService, StoreMappingService>();
|
||
|
||
// Localization
|
||
builder.Services.AddScoped<ILanguageService, LanguageService>();
|
||
builder.Services.AddScoped<ILocalizationService, LocalizationService>();
|
||
builder.Services.AddScoped<ILocalizedEntityService, LocalizedEntityService>();
|
||
|
||
// Currency & Directory
|
||
builder.Services.AddScoped<ICurrencyService, CurrencyService>();
|
||
builder.Services.AddScoped<ICountryService, CountryService>();
|
||
builder.Services.AddScoped<IStateProvinceService, StateProvinceService>();
|
||
builder.Services.AddScoped<IMeasureService, MeasureService>();
|
||
builder.Services.AddScoped<IGeoLookupService, GeoLookupService>();
|
||
|
||
// Customer
|
||
builder.Services.AddScoped<ICustomerService, CustomerService>();
|
||
builder.Services.AddScoped<ICustomerRegistrationService, CustomerRegistrationService>();
|
||
builder.Services.AddScoped<ICustomerReportService, CustomerReportService>();
|
||
builder.Services.AddScoped<ICustomerActivityService, CustomerActivityService>();
|
||
builder.Services.AddScoped<INewsLetterSubscriptionService, NewsLetterSubscriptionService>();
|
||
|
||
// Address & Vendor & Affiliate
|
||
builder.Services.AddScoped<IAddressService, AddressService>();
|
||
builder.Services.AddScoped<IVendorService, VendorService>();
|
||
builder.Services.AddScoped<IAffiliateService, AffiliateService>();
|
||
|
||
// Generic Attribute
|
||
builder.Services.AddScoped<IGenericAttributeService, GenericAttributeService>();
|
||
|
||
// Maintenance
|
||
builder.Services.AddScoped<IMaintenanceService, MaintenanceService>();
|
||
|
||
// Catalog
|
||
builder.Services.AddScoped<IBackInStockSubscriptionService, BackInStockSubscriptionService>();
|
||
builder.Services.AddScoped<ICategoryService, CategoryService>();
|
||
builder.Services.AddScoped<ICompareProductsService, CompareProductsService>();
|
||
builder.Services.AddScoped<IRecentlyViewedProductsService, RecentlyViewedProductsService>();
|
||
builder.Services.AddScoped<IManufacturerService, ManufacturerService>();
|
||
builder.Services.AddScoped<IProductAttributeFormatter, ProductAttributeFormatter>();
|
||
builder.Services.AddScoped<IProductAttributeParser, ProductAttributeParser>();
|
||
builder.Services.AddScoped<IProductAttributeService, ProductAttributeService>();
|
||
builder.Services.AddScoped<IProductService, ProductService>();
|
||
builder.Services.AddScoped<ICopyProductService, CopyProductService>();
|
||
builder.Services.AddScoped<ISpecificationAttributeService, SpecificationAttributeService>();
|
||
builder.Services.AddScoped<IProductTemplateService, ProductTemplateService>();
|
||
builder.Services.AddScoped<ICategoryTemplateService, CategoryTemplateService>();
|
||
builder.Services.AddScoped<IManufacturerTemplateService, ManufacturerTemplateService>();
|
||
builder.Services.AddScoped<IProductTagService, ProductTagService>();
|
||
builder.Services.AddScoped<IReviewTypeService, ReviewTypeService>();
|
||
|
||
// Pricing (CustomPriceCalculationService a FruitBank-b<>l)
|
||
builder.Services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>();
|
||
builder.Services.AddScoped<PriceCalculationService, CustomPriceCalculationService>();
|
||
builder.Services.AddScoped<IPriceFormatter, PriceFormatter>();
|
||
|
||
// Search
|
||
builder.Services.AddScoped<ISearchTermService, SearchTermService>();
|
||
|
||
// Orders
|
||
builder.Services.AddScoped<IOrderService, OrderService>();
|
||
builder.Services.AddScoped<IOrderReportService, OrderReportService>();
|
||
builder.Services.AddScoped<IOrderProcessingService, OrderProcessingService>();
|
||
builder.Services.AddScoped<IOrderTotalCalculationService, OrderTotalCalculationService>();
|
||
builder.Services.AddScoped<IShoppingCartService, ShoppingCartService>();
|
||
builder.Services.AddScoped<ICheckoutAttributeFormatter, CheckoutAttributeFormatter>();
|
||
builder.Services.AddScoped<IGiftCardService, GiftCardService>();
|
||
builder.Services.AddScoped<IReturnRequestService, ReturnRequestService>();
|
||
builder.Services.AddScoped<IRewardPointService, RewardPointService>();
|
||
builder.Services.AddScoped<ICustomNumberFormatter, CustomNumberFormatter>();
|
||
|
||
// Shipping
|
||
builder.Services.AddScoped<IShipmentService, ShipmentService>();
|
||
builder.Services.AddScoped<IShippingService, ShippingService>();
|
||
builder.Services.AddScoped<IDateRangeService, DateRangeService>();
|
||
|
||
// Tax
|
||
builder.Services.AddScoped<ITaxCategoryService, TaxCategoryService>();
|
||
builder.Services.AddScoped<ICheckVatService, CheckVatService>();
|
||
builder.Services.AddScoped<ITaxService, TaxService>();
|
||
|
||
// Payment
|
||
builder.Services.AddScoped<IPaymentService, PaymentService>();
|
||
|
||
// Discounts
|
||
builder.Services.AddScoped<IDiscountService, DiscountService>();
|
||
|
||
// Media
|
||
builder.Services.AddScoped<IDownloadService, DownloadService>();
|
||
builder.Services.AddScoped<IPictureService, PictureService>();
|
||
builder.Services.AddScoped<IVideoService, VideoService>();
|
||
|
||
// Messages & Notifications
|
||
builder.Services.AddScoped<IMessageTemplateService, MessageTemplateService>();
|
||
builder.Services.AddScoped<IQueuedEmailService, QueuedEmailService>();
|
||
builder.Services.AddScoped<ICampaignService, CampaignService>();
|
||
builder.Services.AddScoped<IEmailAccountService, EmailAccountService>();
|
||
builder.Services.AddScoped<IWorkflowMessageService, WorkflowMessageService>();
|
||
builder.Services.AddScoped<IMessageTokenProvider, MessageTokenProvider>();
|
||
builder.Services.AddScoped<ITokenizer, Tokenizer>();
|
||
builder.Services.AddScoped<ISmtpBuilder, SmtpBuilder>();
|
||
builder.Services.AddScoped<IEmailSender, EmailSender>();
|
||
builder.Services.AddScoped<INotificationService, NotificationService>();
|
||
|
||
// SEO & HTML
|
||
builder.Services.AddScoped<IUrlRecordService, UrlRecordService>();
|
||
builder.Services.AddScoped<IBBCodeHelper, BBCodeHelper>();
|
||
builder.Services.AddScoped<IHtmlFormatter, HtmlFormatter>();
|
||
builder.Services.AddScoped<INopUrlHelper, NopUrlHelper>();
|
||
|
||
// Logging
|
||
builder.Services.AddScoped<Nop.Services.Logging.ILogger, DefaultLogger>();
|
||
|
||
// Topics & Content
|
||
builder.Services.AddScoped<ITopicService, TopicService>();
|
||
builder.Services.AddScoped<ITopicTemplateService, TopicTemplateService>();
|
||
builder.Services.AddScoped<IBlogService, BlogService>();
|
||
builder.Services.AddScoped<INewsService, NewsService>();
|
||
builder.Services.AddScoped<IForumService, ForumService>();
|
||
builder.Services.AddScoped<IPollService, PollService>();
|
||
|
||
// GDPR
|
||
builder.Services.AddScoped<IGdprService, GdprService>();
|
||
|
||
// Export/Import
|
||
builder.Services.AddScoped<IExportManager, ExportManager>();
|
||
builder.Services.AddScoped<IImportManager, ImportManager>();
|
||
builder.Services.AddScoped<IPdfService, PdfService>();
|
||
builder.Services.AddScoped<IUploadService, UploadService>();
|
||
|
||
// Themes
|
||
builder.Services.AddScoped<IThemeProvider, ThemeProvider>();
|
||
builder.Services.AddScoped<IThemeContext, ThemeContext>();
|
||
|
||
// Schedule Tasks
|
||
builder.Services.AddSingleton<ITaskScheduler, Nop.Services.ScheduleTasks.TaskScheduler>();
|
||
builder.Services.AddTransient<IScheduleTaskRunner, ScheduleTaskRunner>();
|
||
builder.Services.AddScoped<IScheduleTaskService, ScheduleTaskService>();
|
||
|
||
// Installation
|
||
builder.Services.AddScoped<IInstallationService, InstallationService>();
|
||
builder.Services.AddScoped<IInstallationLocalizationService, InstallationLocalizationService>();
|
||
|
||
// Slug Route Transformer (ha van adatb<74>zis)
|
||
builder.Services.AddScoped<SlugRouteTransformer>();
|
||
|
||
// Routing
|
||
builder.Services.AddSingleton<IRoutePublisher, RoutePublisher>();
|
||
|
||
// Roxy File Manager
|
||
builder.Services.AddScoped<IRoxyFilemanService, RoxyFilemanService>();
|
||
builder.Services.AddScoped<IRoxyFilemanFileProvider, RoxyFilemanFileProvider>();
|
||
|
||
// Web Framework
|
||
builder.Services.AddScoped<INopHtmlHelper, NopHtmlHelper>();
|
||
builder.Services.AddScoped<Nop.Web.Framework.Factories.IWidgetModelFactory, Nop.Web.Framework.Factories.WidgetModelFactory>();
|
||
builder.Services.AddScoped<IAdminMenu, AdminMenu>();
|
||
|
||
// Attribute Services (generic)
|
||
builder.Services.AddScoped(typeof(IAttributeService<,>), typeof(AttributeService<,>));
|
||
builder.Services.AddScoped(typeof(IAttributeParser<,>), typeof(Nop.Services.Attributes.AttributeParser<,>));
|
||
builder.Services.AddScoped(typeof(IAttributeFormatter<,>), typeof(AttributeFormatter<,>));
|
||
|
||
// Plugin Managers (generic)
|
||
builder.Services.AddScoped(typeof(IPluginManager<>), typeof(PluginManager<>));
|
||
|
||
// ===========================================
|
||
// === PLUGIN MANAGEREK (Null implement<6E>ci<63>k) ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<IExchangeRatePluginManager, NullExchangeRatePluginManager>();
|
||
builder.Services.AddScoped<ISearchPluginManager, NullSearchPluginManager>();
|
||
builder.Services.AddScoped<IDiscountPluginManager, NullDiscountPluginManager>();
|
||
builder.Services.AddScoped<IMultiFactorAuthenticationPluginManager, NullMultiFactorAuthenticationPluginManager>();
|
||
builder.Services.AddScoped<IWidgetPluginManager, NullWidgetPluginManager>();
|
||
builder.Services.AddScoped<IPaymentPluginManager, NullPaymentPluginManager>();
|
||
builder.Services.AddScoped<IPickupPluginManager, NullPickupPluginManager>();
|
||
builder.Services.AddScoped<IShippingPluginManager, NullShippingPluginManager>();
|
||
builder.Services.AddScoped<ITaxPluginManager, NullTaxPluginManager>();
|
||
builder.Services.AddScoped<IAuthenticationPluginManager, NullAuthenticationPluginManager>();
|
||
|
||
// ===========================================
|
||
// === NOP.WEB COMMON FACTORIES (Nop.Web\Infrastructure\NopStartup.cs) ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<IDiscountSupportedModelFactory, DiscountSupportedModelFactory>();
|
||
builder.Services.AddScoped<ILocalizedModelFactory, LocalizedModelFactory>();
|
||
builder.Services.AddScoped<IStoreMappingSupportedModelFactory, StoreMappingSupportedModelFactory>();
|
||
|
||
// ===========================================
|
||
// === NOP.WEB ADMIN MODEL FACTORIES (Nop.Web\Infrastructure\NopStartup.cs) ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<IAclSupportedModelFactory, AclSupportedModelFactory>();
|
||
builder.Services.AddScoped<IBaseAdminModelFactory, BaseAdminModelFactory>();
|
||
builder.Services.AddScoped<IActivityLogModelFactory, ActivityLogModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IAddressModelFactory, Nop.Web.Areas.Admin.Factories.AddressModelFactory>();
|
||
builder.Services.AddScoped<IAddressAttributeModelFactory, AddressAttributeModelFactory>();
|
||
builder.Services.AddScoped<IAffiliateModelFactory, AffiliateModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IBlogModelFactory, Nop.Web.Areas.Admin.Factories.BlogModelFactory>();
|
||
builder.Services.AddScoped<ICampaignModelFactory, CampaignModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICategoryModelFactory, Nop.Web.Areas.Admin.Factories.CategoryModelFactory>();
|
||
builder.Services.AddScoped<ICheckoutAttributeModelFactory, CheckoutAttributeModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICommonModelFactory, Nop.Web.Areas.Admin.Factories.CommonModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICountryModelFactory, Nop.Web.Areas.Admin.Factories.CountryModelFactory>();
|
||
builder.Services.AddScoped<ICurrencyModelFactory, CurrencyModelFactory>();
|
||
builder.Services.AddScoped<ICustomerAttributeModelFactory, CustomerAttributeModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICustomerModelFactory, Nop.Web.Areas.Admin.Factories.CustomerModelFactory>();
|
||
builder.Services.AddScoped<ICustomerRoleModelFactory, CustomerRoleModelFactory>();
|
||
builder.Services.AddScoped<IDiscountModelFactory, DiscountModelFactory>();
|
||
builder.Services.AddScoped<IEmailAccountModelFactory, EmailAccountModelFactory>();
|
||
builder.Services.AddScoped<IExternalAuthenticationMethodModelFactory, ExternalAuthenticationMethodModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IForumModelFactory, Nop.Web.Areas.Admin.Factories.ForumModelFactory>();
|
||
builder.Services.AddScoped<IGiftCardModelFactory, GiftCardModelFactory>();
|
||
builder.Services.AddScoped<IHomeModelFactory, HomeModelFactory>();
|
||
builder.Services.AddScoped<ILanguageModelFactory, LanguageModelFactory>();
|
||
builder.Services.AddScoped<ILogModelFactory, LogModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IManufacturerModelFactory, Nop.Web.Areas.Admin.Factories.ManufacturerModelFactory>();
|
||
builder.Services.AddScoped<IMeasureModelFactory, MeasureModelFactory>();
|
||
builder.Services.AddScoped<IMessageTemplateModelFactory, MessageTemplateModelFactory>();
|
||
builder.Services.AddScoped<IMultiFactorAuthenticationMethodModelFactory, MultiFactorAuthenticationMethodModelFactory>();
|
||
builder.Services.AddScoped<INewsletterSubscriptionModelFactory, NewsletterSubscriptionModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.INewsModelFactory, Nop.Web.Areas.Admin.Factories.NewsModelFactory>();
|
||
// IOrderModelFactory - FruitBank CustomOrderModelFactory fel<65>l<EFBFBD>rja!
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IOrderModelFactory, CustomOrderModelFactory>();
|
||
builder.Services.AddScoped<IPaymentModelFactory, PaymentModelFactory>();
|
||
builder.Services.AddScoped<IPluginModelFactory, PluginModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IPollModelFactory, Nop.Web.Areas.Admin.Factories.PollModelFactory>();
|
||
// IProductModelFactory - FruitBank CustomProductModelFactory fel<65>l<EFBFBD>rja!
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IProductModelFactory, CustomProductModelFactory>();
|
||
builder.Services.AddScoped<IProductAttributeModelFactory, ProductAttributeModelFactory>();
|
||
builder.Services.AddScoped<IProductReviewModelFactory, ProductReviewModelFactory>();
|
||
builder.Services.AddScoped<IReportModelFactory, ReportModelFactory>();
|
||
builder.Services.AddScoped<IQueuedEmailModelFactory, QueuedEmailModelFactory>();
|
||
builder.Services.AddScoped<IRecurringPaymentModelFactory, RecurringPaymentModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IReturnRequestModelFactory, Nop.Web.Areas.Admin.Factories.ReturnRequestModelFactory>();
|
||
builder.Services.AddScoped<IReviewTypeModelFactory, ReviewTypeModelFactory>();
|
||
builder.Services.AddScoped<IScheduleTaskModelFactory, ScheduleTaskModelFactory>();
|
||
builder.Services.AddScoped<ISecurityModelFactory, SecurityModelFactory>();
|
||
builder.Services.AddScoped<ISettingModelFactory, SettingModelFactory>();
|
||
builder.Services.AddScoped<IShippingModelFactory, ShippingModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IShoppingCartModelFactory, Nop.Web.Areas.Admin.Factories.ShoppingCartModelFactory>();
|
||
builder.Services.AddScoped<ISpecificationAttributeModelFactory, SpecificationAttributeModelFactory>();
|
||
builder.Services.AddScoped<IStoreModelFactory, StoreModelFactory>();
|
||
builder.Services.AddScoped<ITaxModelFactory, TaxModelFactory>();
|
||
builder.Services.AddScoped<ITemplateModelFactory, TemplateModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ITopicModelFactory, Nop.Web.Areas.Admin.Factories.TopicModelFactory>();
|
||
builder.Services.AddScoped<IVendorAttributeModelFactory, VendorAttributeModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IVendorModelFactory, Nop.Web.Areas.Admin.Factories.VendorModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IWidgetModelFactory, Nop.Web.Areas.Admin.Factories.WidgetModelFactory>();
|
||
|
||
// ===========================================
|
||
// === NOP.WEB PUBLIC FACTORIES (Nop.Web\Infrastructure\NopStartup.cs) ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<Nop.Web.Factories.IAddressModelFactory, Nop.Web.Factories.AddressModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IBlogModelFactory, Nop.Web.Factories.BlogModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ICatalogModelFactory, Nop.Web.Factories.CatalogModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ICheckoutModelFactory, Nop.Web.Factories.CheckoutModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ICommonModelFactory, Nop.Web.Factories.CommonModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ICountryModelFactory, Nop.Web.Factories.CountryModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ICustomerModelFactory, Nop.Web.Factories.CustomerModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IForumModelFactory, Nop.Web.Factories.ForumModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IExternalAuthenticationModelFactory, Nop.Web.Factories.ExternalAuthenticationModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IJsonLdModelFactory, Nop.Web.Factories.JsonLdModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.INewsModelFactory, Nop.Web.Factories.NewsModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.INewsletterModelFactory, Nop.Web.Factories.NewsletterModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IOrderModelFactory, Nop.Web.Factories.OrderModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IPollModelFactory, Nop.Web.Factories.PollModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IPrivateMessagesModelFactory, Nop.Web.Factories.PrivateMessagesModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IProductModelFactory, Nop.Web.Factories.ProductModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IProfileModelFactory, Nop.Web.Factories.ProfileModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IReturnRequestModelFactory, Nop.Web.Factories.ReturnRequestModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IShoppingCartModelFactory, Nop.Web.Factories.ShoppingCartModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ISitemapModelFactory, Nop.Web.Factories.SitemapModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.ITopicModelFactory, Nop.Web.Factories.TopicModelFactory>();
|
||
builder.Services.AddScoped<Nop.Web.Factories.IVendorModelFactory, Nop.Web.Factories.VendorModelFactory>();
|
||
|
||
// ===========================================
|
||
// === NOP.WEB HELPERS ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddScoped<ITinyMceHelper, TinyMceHelper>();
|
||
|
||
// ===========================================
|
||
// === FRUITBANK PLUGIN SZOLG<4C>LTAT<41>SOK (PluginNopStartup-b<>l) ===
|
||
// ===========================================;
|
||
|
||
// Logger
|
||
builder.Services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
|
||
builder.Services.AddTransient<INopLoggerMsSqlNopDataProvider, NopLoggerMsSqlNopDataProvider>();
|
||
builder.Services.AddScoped<IAcLogWriterBase, NopLogWriter>();
|
||
builder.Services.AddSingleton<LoggerToLoggerApiController>();
|
||
|
||
// Core
|
||
builder.Services.AddSingleton<ILockService, LockService>();
|
||
builder.Services.AddScoped<FruitBankAttributeService>();
|
||
|
||
// Event Consumer
|
||
builder.Services.AddScoped<IConsumer<OrderPlacedEvent>, EventConsumer>();
|
||
|
||
// Business Services
|
||
builder.Services.AddScoped<IOrderMeasurementService, OrderMeasurementService>();
|
||
builder.Services.AddScoped<MeasurementService>();
|
||
builder.Services.AddScoped<InnVoiceApiService>();
|
||
builder.Services.AddScoped<InnVoiceOrderService>();
|
||
builder.Services.AddScoped<CerebrasAPIService>();
|
||
builder.Services.AddScoped<OpenAIApiService>();
|
||
builder.Services.AddScoped<AICalculationService>();
|
||
builder.Services.AddScoped<PdfToImageService>();
|
||
|
||
// ReplicateService with HttpClient
|
||
builder.Services.AddScoped<ReplicateService>();
|
||
builder.Services.AddHttpClient<ReplicateService>(client =>
|
||
{
|
||
client.DefaultRequestHeaders.Authorization =
|
||
new AuthenticationHeaderValue("Bearer", "r8_MUApXYIE5mRjxqy20tsGLehWBJkCzNj0Cwvrh");
|
||
});
|
||
|
||
// DbTable Services
|
||
builder.Services.AddScoped<ProductDtoDbTable>();
|
||
builder.Services.AddScoped<OrderDtoDbTable>();
|
||
builder.Services.AddScoped<OrderItemDtoDbTable>();
|
||
builder.Services.AddScoped<OrderItemPalletDbTable>();
|
||
builder.Services.AddScoped<PartnerDbTable>();
|
||
builder.Services.AddScoped<ShippingDbTable>();
|
||
builder.Services.AddScoped<ShippingDocumentDbTable>();
|
||
builder.Services.AddScoped<ShippingItemDbTable>();
|
||
builder.Services.AddScoped<ShippingItemPalletDbTable>();
|
||
builder.Services.AddScoped<FilesDbTable>();
|
||
builder.Services.AddScoped<ShippingDocumentToFilesDbTable>();
|
||
builder.Services.AddScoped<StockQuantityHistoryDtoDbTable>();
|
||
builder.Services.AddScoped<StockTakingDbTable>();
|
||
builder.Services.AddScoped<StockTakingItemDbTable>();
|
||
builder.Services.AddScoped<StockTakingItemPalletDbTable>();
|
||
|
||
// DbContext Services
|
||
builder.Services.AddScoped<StockTakingDbContext>();
|
||
builder.Services.AddScoped<FruitBankDbContext>();
|
||
|
||
// SignalR Services
|
||
builder.Services.AddScoped<SignalRSendToClientService>();
|
||
builder.Services.AddScoped<IFruitBankDataControllerServer, FruitBankDataController>();
|
||
builder.Services.AddScoped<ICustomOrderSignalREndpointServer, CustomOrderSignalREndpoint>();
|
||
builder.Services.AddScoped<IStockSignalREndpointServer, StockSignalREndpointServer>();
|
||
|
||
// ===========================================
|
||
// === SIGNALR KONFIGUR<55>CI<43> ===
|
||
// ===========================================
|
||
|
||
builder.Services.AddSignalR(hubOptions =>
|
||
{
|
||
hubOptions.EnableDetailedErrors = true;
|
||
hubOptions.MaximumReceiveMessageSize = 30_000_000;
|
||
hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignalRKeepAliveIntervalSecond);
|
||
hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignarlRTimeoutIntervalSecond);
|
||
hubOptions.StatefulReconnectBufferSize = 30_000_000;
|
||
});
|
||
|
||
// ===========================================
|
||
// === APP BUILD ===
|
||
// ===========================================
|
||
|
||
var app = builder.Build();
|
||
|
||
app.UseCors("SignalR");
|
||
app.UseSession();
|
||
|
||
var fruitBankHubEndPoint = $"/{FruitBankConstClient.DefaultHubName}";
|
||
app.MapHub<DevAdminSignalRHub>(fruitBankHubEndPoint, options =>
|
||
{
|
||
options.Transports = HttpTransportType.WebSockets;
|
||
options.WebSockets.CloseTimeout = TimeSpan.FromSeconds(10);
|
||
options.AllowStatefulReconnects = true;
|
||
options.TransportMaxBufferSize = 30_000_000;
|
||
options.ApplicationMaxBufferSize = 30_000_000;
|
||
options.TransportSendTimeout = TimeSpan.FromSeconds(60);
|
||
});
|
||
|
||
var loggerHubEndPoint = $"/{FruitBankConstClient.LoggerHubName}";
|
||
app.MapHub<LoggerSignalRHub>(loggerHubEndPoint, options =>
|
||
{
|
||
options.AllowStatefulReconnects = false;
|
||
});
|
||
|
||
app.MapGet("/", () => "SANDBOX is running!");
|
||
app.MapGet("/health", () => Results.Ok(new { status = "healthy", timestamp = DateTime.UtcNow }));
|
||
|
||
// ===========================================
|
||
// === CONSOLE OUTPUT ===
|
||
// ===========================================
|
||
|
||
var finalConnectionString = app.Configuration.GetConnectionString("ConnectionString") ?? "";
|
||
var databaseName = "Unknown";
|
||
if (!string.IsNullOrEmpty(finalConnectionString))
|
||
{
|
||
var match = System.Text.RegularExpressions.Regex.Match(finalConnectionString, @"Initial Catalog=([^;]+)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||
if (match.Success)
|
||
{
|
||
databaseName = match.Groups[1].Value;
|
||
}
|
||
}
|
||
|
||
Console.Title = $"[SB] - {databaseName}";
|
||
|
||
Console.WriteLine("===========================================");
|
||
Console.WriteLine($" FRUITBANK SANDBOX - {databaseName}");
|
||
Console.WriteLine("===========================================");
|
||
Console.WriteLine($" Database: {databaseName}");
|
||
Console.WriteLine($" Base URL: http://localhost:59579");
|
||
Console.WriteLine($" SignalR Hub: {fruitBankHubEndPoint}");
|
||
Console.WriteLine($" Logger Hub: {loggerHubEndPoint}");
|
||
Console.WriteLine("===========================================");
|
||
|
||
app.Run();
|