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
using Grand.Data.LiteDb;
using Grand.Domain;
using LiteDB;
using System.Linq.Expressions;
namespace Grand.Data.Tests.LiteDb;
public class LiteDBRepositoryMock<T> : LiteDBRepository<T>, IRepository<T> where T : BaseEntity
{
public LiteDBRepositoryMock() : base(Guid.NewGuid().ToString(), new AuditInfoProvider())
{
Database = new LiteDatabase(new MemoryStream());
Database.DropCollection(typeof(T).Name);
Collection = Database.GetCollection<T>(typeof(T).Name);
}
public void EnsureUniqueIndex<K>(Expression<Func<T, K>> keySelector)
{
Collection.EnsureIndex(keySelector, true);
}
}