Skip to content

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.

Add support MongoDB.Driver for LINQ Provider V3

KrzysztofPajake2a50a248fd1
diff --git a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs b/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs
index abbfc2b71..528be0491 100644
--- a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs
+++ b/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs
@@ -37,8 +37,9 @@ namespace Grand.Infrastructure.Startup
var connectionString = dataProviderSettings.ConnectionString;
var mongourl = new MongoUrl(connectionString);
var databaseName = mongourl.DatabaseName;
- serviceCollection.AddScoped(c => new MongoClient(mongourl).GetDatabase(databaseName));
-
+ var clientSettings = MongoClientSettings.FromConnectionString(connectionString);
+ clientSettings.LinqProvider = MongoDB.Driver.Linq.LinqProvider.V3;
+ serviceCollection.AddScoped(c => new MongoClient(clientSettings).GetDatabase(databaseName));
}
//database context