Compare commits

...

3 Commits

Author SHA1 Message Date
Loretta 38ec5c475e improvements 2024-11-15 15:15:56 +01:00
Loretta 1e2856c565 auction improvements 2024-11-15 06:15:34 +01:00
Loretta 3197542c83 improvement 2024-11-14 12:53:23 +01:00
10 changed files with 157 additions and 18 deletions

View File

@ -3,6 +3,6 @@ using Nop.Core;
namespace Mango.Nop.Core.Entities;
public class EntityBase : BaseEntity, IEntityInt
public class MgEntityBase : BaseEntity, IEntityInt
{
}

View File

@ -0,0 +1,20 @@
namespace Mango.Nop.Core.Interfaces;
public interface IMgDalBase //: IAcDalBase//: IDisposable
{
public string Name { get; }
}
public interface IMgDalBase<out TDbContext> : IMgDalBase where TDbContext : IMgDbContextBase
{
//public bool AutoCloseSession { get; set; }
/// <summary>
/// Do not use it! Use Session or Transaction... - J.
/// </summary>
public TDbContext Context { get; }
public Mutex MutextLock { get; }
//public TDbContext CreateDbContext();
//public void CloseDbContext(ref TDbContext? ctx);
}

View File

@ -0,0 +1,6 @@
namespace Mango.Nop.Core.Interfaces;
public interface IMgDbContextBase //: IAcDbContextBase
{
}

View File

@ -0,0 +1,16 @@
using Mango.Nop.Core.Entities;
using Nop.Data;
namespace Mango.Nop.Core.Interfaces;
public interface IMgDbTableBase //: IAcDbTableBase
{
}
//public interface IMgDbTableBase<TAuction> /*: IAcDbTableBase*/ where TAuction : EntityBase
//{
// IRepository<TAuction>
//}
//public interface IMgDbTableBase<TRepository, TAuction> /*: IAcDbTableBase*/ where TAuction : EntityBase where TRepository : IRepository<TAuction>
//{}

View File

@ -4,7 +4,7 @@ using Nop.Core.Domain.Common;
namespace Mango.Nop.Core.Interfaces;
// ReSharper disable once PossibleInterfaceMemberAmbiguity
public interface ISoftRemoveEntity : IAcSoftRemoveEntity, ISoftDeletedEntity
public interface IMgSoftRemoveEntity : IAcSoftRemoveEntity, ISoftDeletedEntity
{
}

View File

@ -3,7 +3,7 @@
namespace Mango.Nop.Core.Interfaces;
// ReSharper disable once PossibleInterfaceMemberAmbiguity
public interface ISoftRemoveEntityInt : IAcSoftRemoveEntityInt, ISoftRemoveEntity
public interface IMgSoftRemoveEntityInt : IAcSoftRemoveEntityInt, IMgSoftRemoveEntity
{
}

View File

@ -1,15 +0,0 @@
using System.Linq.Expressions;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
namespace Mango.Nop.Core.Repositories;
public class DalBase<TEntity> : EntityRepository<TEntity> where TEntity : BaseEntity
{
public DalBase(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}
}

View File

@ -0,0 +1,18 @@
using System.Linq.Expressions;
using System.Transactions;
using Mango.Nop.Core.Interfaces;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Data.DataProviders;
namespace Mango.Nop.Core.Repositories;
public class MgDalBase<TDbContext> : IMgDalBase<TDbContext> where TDbContext : IMgDbContextBase
{
public string Name { get; }
public TDbContext Context { get; }
public Mutex MutextLock { get; }
}

View File

@ -0,0 +1,15 @@
using Mango.Nop.Core.Interfaces;
using Nop.Data;
namespace Mango.Nop.Core.Repositories;
public class MgDbContextBase : IMgDbContextBase
{
protected INopDataProvider DataProvider;
public MgDbContextBase(INopDataProvider dataProvider)
{
DataProvider = dataProvider;
}
}

View File

@ -0,0 +1,79 @@
using System.Linq.Expressions;
using Mango.Nop.Core.Interfaces;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
namespace Mango.Nop.Core.Repositories;
public class MgDbTableBase<TEntity>(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: EntityRepository<TEntity>(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings), IMgDbTableBase where TEntity : BaseEntity
{
protected IEventPublisher EventPublisher = eventPublisher;
protected INopDataProvider DataProvider = dataProvider;
protected IShortTermCacheManager ShortTermCacheManager = shortTermCacheManager;
protected IStaticCacheManager StaticCacheManager = staticCacheManager;
public override void Update(TEntity entity, bool publishEvent = true)
{
base.Update(entity, publishEvent);
}
public override void Update(IList<TEntity> entities, bool publishEvent = true)
{
base.Update(entities, publishEvent);
}
public override Task UpdateAsync(TEntity entity, bool publishEvent = true)
{
return base.UpdateAsync(entity, publishEvent);
}
public override Task UpdateAsync(IList<TEntity> entities, bool publishEvent = true)
{
return base.UpdateAsync(entities, publishEvent);
}
protected override Task DeleteAsync(IList<TEntity> entities)
{
return base.DeleteAsync(entities);
}
protected override Task DeleteAsync<T>(IList<T> entities)
{
return base.DeleteAsync(entities);
}
protected override IQueryable<TEntity> AddDeletedFilter(IQueryable<TEntity> query, in bool includeDeleted)
{
return base.AddDeletedFilter(query, in includeDeleted);
}
public override Task DeleteAsync(TEntity entity, bool publishEvent = true)
{
return base.DeleteAsync(entity, publishEvent);
}
public override Task DeleteAsync(IList<TEntity> entities, bool publishEvent = true)
{
return base.DeleteAsync(entities, publishEvent);
}
public override Task<int> DeleteAsync(Expression<Func<TEntity, bool>> predicate)
{
return base.DeleteAsync(predicate);
}
public override void Delete(TEntity entity, bool publishEvent = true)
{
base.Delete(entity, publishEvent);
}
public override int Delete(Expression<Func<TEntity, bool>> predicate)
{
return base.Delete(predicate);
}
}