improvement

This commit is contained in:
Loretta 2024-11-14 12:53:23 +01:00
parent 7851e8a8ee
commit a48ad3d132
6 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,14 @@
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
public class AuctionBidDbTable: EntityRepository<AuctionBid>
{
public AuctionBidDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}
}

View File

@ -0,0 +1,11 @@
using Mango.Nop.Core.Repositories;
using Nop.Data;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
public class AuctionDbContext : MgDbContextBase, IAuctionDbSet<AuctionDbTable>, IAuctionBidDbSet<AuctionBidDbTable>
{
public AuctionDbTable Auctions { get; set; }
public AuctionBidDbTable AuctionBids { get; set; }
}

View File

@ -0,0 +1,14 @@
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
public class AuctionDbTable: EntityRepository<Auction>
{
public AuctionDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}
}

View File

@ -0,0 +1,33 @@
using System.Transactions;
using Mango.Nop.Core.Repositories;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Domain.Catalog;
using Nop.Core.Events;
using Nop.Data;
using Nop.Data.DataProviders;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
public class AuctionMgDal : MgDalBase<MgDbContextBase>
{
public IRepository<Auction> Auctions { get; set; }
//public AuctionMgDal(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
// : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
//{
//}
public async Task AddProductToAuction(Product product, Auction auction)
{
//using var dataContext = ((MsSqlNopDataProvider)_dataProvider).
//dataProvider.GetTable<TEntity>().wh
//using var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
//await _dataProvider.InsertEntityAsync()
// InsertEntityAsync(product);
//transaction.Complete();
}
}

View File

@ -0,0 +1,10 @@
using Mango.Nop.Core.Interfaces;
using Nop.Data;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
public interface IAuctionBidDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<AuctionBid>
{
public TDbTable AuctionBids { get; set; }
}

View File

@ -0,0 +1,10 @@
using Mango.Nop.Core.Interfaces;
using Nop.Data;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
public interface IAuctionDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<Auction>
{
public TDbTable Auctions { get; set; }
}