improvement

This commit is contained in:
Loretta 2024-11-14 12:53:23 +01:00
parent bf21342abb
commit 3197542c83
6 changed files with 69 additions and 15 deletions

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

@ -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,9 @@
using Mango.Nop.Core.Interfaces;
namespace Mango.Nop.Core.Repositories;
public class MgDbContextBase : IMgDbContextBase
{
}