Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Refactor IDatabaseContext and update implementations
KrzysztofPajakd8a5ec59bdd7
diff --git a/src/Core/Grand.Data/IDatabaseContext.cs b/src/Core/Grand.Data/IDatabaseContext.csindex b79f63670..69484547a 100644--- a/src/Core/Grand.Data/IDatabaseContext.cs+++ b/src/Core/Grand.Data/IDatabaseContext.cs@@ -7,13 +7,10 @@ public interface IDatabaseContextbool InstallProcessCreateTable { get; }bool InstallProcessCreateIndex { get; }void SetConnection(string connectionString);- Task<bool> DatabaseExist();- IQueryable<T> Table<T>(string collectionName);+ Task<bool> DatabaseExist();Task CreateTable(string name, string collation);Task DeleteTable(string name);-Task CreateIndex<T>(IRepository<T> repository, OrderBuilder<T> orderBuilder, string indexName, bool unique = false)where T : BaseEntity;-Task DeleteIndex<T>(IRepository<T> repository, string indexName) where T : BaseEntity;}\ No newline at end of filediff --git a/src/Core/Grand.Data/LiteDb/LiteDBContext.cs b/src/Core/Grand.Data/LiteDb/LiteDBContext.csindex 15a48bec5..1e0547330 100644--- a/src/Core/Grand.Data/LiteDb/LiteDBContext.cs+++ b/src/Core/Grand.Data/LiteDb/LiteDBContext.cs@@ -23,14 +23,6 @@ public class LiteDBContext : IDatabaseContextpublic bool InstallProcessCreateTable => false;public bool InstallProcessCreateIndex => true;- public IQueryable<T> Table<T>(string collectionName)- {- if (string.IsNullOrEmpty(collectionName))- throw new ArgumentNullException(nameof(collectionName));-- return _database.GetCollection<T>(collectionName).FindAll().AsQueryable();- }-public async Task<bool> DatabaseExist(){return await Task.FromResult(_database.CollectionExists(nameof(GrandNodeVersion)));diff --git a/src/Core/Grand.Data/Mongo/MongoDBContext.cs b/src/Core/Grand.Data/Mongo/MongoDBContext.csindex 003cdaff6..4532a9b65 100644--- a/src/Core/Grand.Data/Mongo/MongoDBContext.cs+++ b/src/Core/Grand.Data/Mongo/MongoDBContext.cs@@ -33,14 +33,6 @@ public class MongoDBContext : IDatabaseContextpublic bool InstallProcessCreateTable => true;public bool InstallProcessCreateIndex => true;- public IQueryable<T> Table<T>(string collectionName)- {- if (string.IsNullOrEmpty(collectionName))- throw new ArgumentNullException(nameof(collectionName));-- return _database.GetCollection<T>(collectionName).AsQueryable();- }-public async Task<bool> DatabaseExist(){if (string.IsNullOrEmpty(_connectionString))