imrpovements, fixes
This commit is contained in:
parent
f16cf75a26
commit
5fca5b3ba3
|
|
@ -1,5 +1,6 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
using Mango.Nop.Core.Interfaces;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Nop.Core.Caching;
|
||||||
using Nop.Core.Domain.Catalog;
|
using Nop.Core.Domain.Catalog;
|
||||||
using Nop.Core.Events;
|
using Nop.Core.Events;
|
||||||
using Nop.Data;
|
using Nop.Data;
|
||||||
|
|
@ -11,6 +12,11 @@ namespace Mango.Nop.Core.Repositories;
|
||||||
|
|
||||||
public class MgDbContextBase : IMgDbContextBase
|
public class MgDbContextBase : IMgDbContextBase
|
||||||
{
|
{
|
||||||
|
//TODO: ez itt nem ay igazi, kitalálni vmit! - J.
|
||||||
|
//private readonly CacheKey _auctionAllKey = new("Nop.auction.all-{0}", AUCTION_PATTERN_KEY);
|
||||||
|
public const string AUCTION_PATTERN_KEY = "Nop.auction.";
|
||||||
|
|
||||||
|
|
||||||
protected ILogger Logger;
|
protected ILogger Logger;
|
||||||
protected INopDataProvider DataProvider;
|
protected INopDataProvider DataProvider;
|
||||||
//protected IHttpContextAccessor HttpContextAccessor;
|
//protected IHttpContextAccessor HttpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ public class MgDbTableBase<TEntity>(IEventPublisher eventPublisher, INopDataProv
|
||||||
protected IEventPublisher EventPublisher = eventPublisher;
|
protected IEventPublisher EventPublisher = eventPublisher;
|
||||||
protected INopDataProvider DataProvider = dataProvider;
|
protected INopDataProvider DataProvider = dataProvider;
|
||||||
protected IShortTermCacheManager ShortTermCacheManager = shortTermCacheManager;
|
protected IShortTermCacheManager ShortTermCacheManager = shortTermCacheManager;
|
||||||
protected IStaticCacheManager StaticCacheManager = staticCacheManager;
|
|
||||||
|
|
||||||
#region SetTimeStampInfos
|
#region SetTimeStampInfos
|
||||||
private static void SetTimeStampCreated(TEntity entity)
|
private static void SetTimeStampCreated(TEntity entity)
|
||||||
|
|
@ -49,6 +48,8 @@ public class MgDbTableBase<TEntity>(IEventPublisher eventPublisher, INopDataProv
|
||||||
{
|
{
|
||||||
SetTimeStampCreated(entity);
|
SetTimeStampCreated(entity);
|
||||||
SetTimeStampModified(entity);
|
SetTimeStampModified(entity);
|
||||||
|
|
||||||
|
//_staticCacheManager.RemoveByPrefix(MgDbContextBase.AUCTION_PATTERN_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUpdate(IList<TEntity> entities)
|
private void OnUpdate(IList<TEntity> entities)
|
||||||
|
|
@ -56,7 +57,13 @@ public class MgDbTableBase<TEntity>(IEventPublisher eventPublisher, INopDataProv
|
||||||
foreach (var entity in entities) OnUpdate(entity);
|
foreach (var entity in entities) OnUpdate(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnUpdate(TEntity entity) => SetTimeStampModified(entity);
|
protected virtual void OnUpdate(TEntity entity)
|
||||||
|
{
|
||||||
|
SetTimeStampModified(entity);
|
||||||
|
|
||||||
|
_staticCacheManager.ClearAsync().GetAwaiter().GetResult();
|
||||||
|
//_staticCacheManager.RemoveByPrefix(MgDbContextBase.AUCTION_PATTERN_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnDelete(IList<TEntity> entities)
|
private void OnDelete(IList<TEntity> entities)
|
||||||
{
|
{
|
||||||
|
|
@ -70,6 +77,7 @@ public class MgDbTableBase<TEntity>(IEventPublisher eventPublisher, INopDataProv
|
||||||
SetTimeStampModified(entity);
|
SetTimeStampModified(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//_staticCacheManager.RemoveByPrefix(MgDbContextBase.AUCTION_PATTERN_KEY);
|
||||||
}
|
}
|
||||||
#endregion OnCrudEvents
|
#endregion OnCrudEvents
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue