refactoring, cleanup, etc...

This commit is contained in:
Loretta 2025-10-22 15:16:20 +02:00
parent 7f0844fb17
commit 3719994ec4
16 changed files with 45 additions and 61 deletions

View File

@ -1,14 +1,14 @@
using FruitBank.Common.Entities;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Core.Repositories;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class FilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) : MgDbTableBase<Files>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public class FilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : MgDbTableBase<Files>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -16,6 +16,7 @@ using Nop.Plugin.Misc.FruitBankPlugin.Services;
using Nop.Services.Catalog;
using FruitBank.Common.Dtos;
using Mango.Nop.Core.Extensions;
using Mango.Nop.Core.Loggers;
using Nop.Core.Domain.Orders;
using WebMarkupMin.Core.Loggers;
@ -68,7 +69,7 @@ public class FruitBankDbContext : MgDbContextBase,
IRepository<Customer> customerRepository,
IRepository<CustomerCustomerRoleMapping> customerCustomerRoleMappingRepository,
IRepository<CustomerRole> customerRoleRepository,
IEnumerable<IAcLogWriterBase> logWriters) : base(dataProvider, lockService, logWriters)
IEnumerable<IAcLogWriterBase> logWriters) : base(dataProvider, lockService, new Logger<FruitBankDbContext>(logWriters.ToArray()))
{
_storeContext = storeContext;
_productService = productService;

View File

@ -5,11 +5,11 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class MeasuringItemPalletBaseDbTable<TEntity>(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) : MgDbTableBase<TEntity>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger) where TEntity
public class MeasuringItemPalletBaseDbTable<TEntity>(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : MgDbTableBase<TEntity>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings) where TEntity
: MgEntityBase, IMeasuringItemPalletBase
{
protected override void OnUpdate(TEntity entity)

View File

@ -7,14 +7,14 @@ using Nop.Core.Configuration;
using Nop.Core.Domain.Orders;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class OrderDtoDbTable : MgDtoDbTableBase<OrderDto, Order>
{
public OrderDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public OrderDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -6,14 +6,14 @@ using Nop.Core.Configuration;
using Nop.Core.Domain.Orders;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class OrderItemDtoDbTable : MgDtoDbTableBase<OrderItemDto, OrderItem>
{
public OrderItemDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public OrderItemDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -4,14 +4,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class OrderItemPalletDbTable : MeasuringItemPalletBaseDbTable<OrderItemPallet>
{
public OrderItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public OrderItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class PartnerDbTable : MgDbTableBase<Partner>
{
public PartnerDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public PartnerDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -6,14 +6,14 @@ using Nop.Core.Configuration;
using Nop.Core.Domain.Catalog;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ProductDtoDbTable : MgDtoDbTableBase<ProductDto, Product>
{
public ProductDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public ProductDtoDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingDbTable : MgDbTableBase<Shipping>
{
public ShippingDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public ShippingDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingDocumentDbTable : MgDbTableBase<ShippingDocument>
{
public ShippingDocumentDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public ShippingDocumentDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -1,5 +1,5 @@
using FruitBank.Common.Entities;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Core.Repositories;
using Nop.Core.Caching;
using Nop.Core.Configuration;
@ -8,7 +8,7 @@ using Nop.Data;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingDocumentToFilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger) : MgDbTableBase<ShippingDocumentToFiles>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public class ShippingDocumentToFilesDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : MgDbTableBase<ShippingDocumentToFiles>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -6,14 +6,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingItemDbTable : MgDbTableBase<ShippingItem>
{
public ShippingItemDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public ShippingItemDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -5,14 +5,14 @@ using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Services.Logging;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class ShippingItemPalletDbTable : MeasuringItemPalletBaseDbTable<ShippingItemPallet>
{
public ShippingItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings, ILogger logger)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings, logger)
public ShippingItemPalletDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}

View File

@ -7,8 +7,8 @@ using FruitBank.Common.Interfaces;
using FruitBank.Common.Server.Interfaces;
using FruitBank.Common.Server.Services.Loggers;
using FruitBank.Common.Server.Services.SignalRs;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Services;
using Mango.Nop.Services.Loggers;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.SignalR;
@ -42,21 +42,20 @@ public class PluginNopStartup : INopStartup
/// <param name="configuration">Configuration of the application</param>
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
services.AddTransient<INopLoggerMsSqlNopDataProvider, NopLoggerMsSqlNopDataProvider>();
services.AddScoped<IAcLogWriterBase, NopLogWriter>();
services.AddScoped<LoggerToLoggerApiController>();
//services.AddSingleton<SessionService>();
services.Configure<RazorViewEngineOptions>(options =>
{
options.ViewLocationExpanders.Add(new ViewLocationExpander());
});
//register services and interfaces
services.AddSingleton<ILockService, LockService>();
services.AddTransient<INopLoggerMsSqlNopDataProvider, NopLoggerMsSqlNopDataProvider>();
services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
services.AddScoped<IAcLogWriterBase, NopLogWriter>();
services.AddScoped<LoggerToLoggerApiController2>();
//services.AddSingleton<SessionService>();
services.AddScoped<FruitBankAttributeService>();
services.AddScoped<ProductDtoDbTable>();
@ -125,7 +124,7 @@ public class PluginNopStartup : INopStartup
{
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<LoggerSignalRHub2>(loggrHubEndPoint);
endpoints.MapHub<LoggerSignalRHub>(loggrHubEndPoint);
});
});
}

View File

@ -1,8 +0,0 @@
using AyCode.Services.Server.SignalRs;
using FruitBank.Common.Server.Services.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Services;
public class LoggerSignalRHub2(LoggerToLoggerApiController2 logger) : AcLoggerSignalRHub<LoggerToLoggerApiController2>(logger)
{ }

View File

@ -1,8 +0,0 @@
using AyCode.Core.Enums;
using AyCode.Core.Loggers;
using FruitBank.Common.Loggers;
using Mango.Nop.Core.Loggers;
namespace Nop.Plugin.Misc.FruitBankPlugin.Services;
public class LoggerToLoggerApiController2(IAcLogWriterBase[] logWriters) : Logger<LoggerToLoggerApiController2>(logWriters);