diff --git a/Directory.Packages.props b/Directory.Packages.props
index c4f7f4e7..33111291 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -13,7 +13,7 @@
-
+
diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs
index b8dab8bd..b5f7b14a 100644
--- a/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs
+++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs
@@ -37,7 +37,7 @@ public async ValueTask> GetAllAsync(Expression>? fil
await repository.GetAllAsync(filter, orderBy, descending, page, pageSize);
public async ValueTask> GetAllByProjectionAsync(
- Expression>? selector,
+ Expression> selector,
Expression>? filter = null,
Expression>? orderBy = null,
bool descending = true,
diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/IRepository.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/IRepository.cs
index aded3743..939da8b8 100644
--- a/src/LinkDotNet.Blog.Infrastructure/Persistence/IRepository.cs
+++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/IRepository.cs
@@ -22,7 +22,7 @@ ValueTask> GetAllAsync(
int pageSize = int.MaxValue);
ValueTask> GetAllByProjectionAsync(
- Expression>? selector,
+ Expression> selector,
Expression>? filter = null,
Expression>? orderBy = null,
bool descending = true,
diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/MongoDBConnectionProvider.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/MongoDBConnectionProvider.cs
index 6a10964b..711ad733 100644
--- a/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/MongoDBConnectionProvider.cs
+++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/MongoDBConnectionProvider.cs
@@ -8,7 +8,11 @@ public static class MongoDBConnectionProvider
{
public static IMongoDatabase Create(string connectionString, string databaseName)
{
+#pragma warning disable IDISP001 // Handled by DI container
+#pragma warning disable CA2000 // Handled by DI container
var client = new MongoClient(connectionString);
+#pragma warning restore CA2000
+#pragma warning restore IDISP001
BsonClassMap.RegisterClassMap(cm =>
{
cm.AutoMap();
diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/PaginatedListQueryExtensions.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/PaginatedListQueryExtensions.cs
index cdc560b4..99cf5a81 100644
--- a/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/PaginatedListQueryExtensions.cs
+++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/PaginatedListQueryExtensions.cs
@@ -1,13 +1,13 @@
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using MongoDB.Driver;
using MongoDB.Driver.Linq;
namespace LinkDotNet.Blog.Infrastructure.Persistence.MongoDB;
public static class PaginatedListQueryExtensions
{
- public static async Task> ToPagedListAsync(this IMongoQueryable source, int pageIndex, int pageSize, CancellationToken token = default)
+ public static async Task> ToPagedListAsync(this IQueryable source, int pageIndex, int pageSize, CancellationToken token = default)
{
var count = await source.CountAsync(token);
if (count > 0)
diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/Repository.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/Repository.cs
index afe2c5ac..a65427a3 100644
--- a/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/Repository.cs
+++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/Repository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using LinkDotNet.Blog.Domain;
@@ -51,7 +52,7 @@ public async ValueTask> GetAllAsync(Expression s, filter, orderBy, descending, page, pageSize);
public async ValueTask> GetAllByProjectionAsync(
- Expression>? selector,
+ Expression> selector,
Expression>? filter = null,
Expression>? orderBy = null,
bool descending = true,
@@ -70,8 +71,9 @@ public async ValueTask> GetAllByProjectionAsync> GetAllAsync(Expression
GetAllByProjectionAsync(s => s, filter, orderBy, descending, page, pageSize);
public async ValueTask> GetAllByProjectionAsync(
- Expression>? selector,
+ Expression> selector,
Expression>? filter = null,
Expression>? orderBy = null,
bool descending = true,
diff --git a/src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Repository.cs b/src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Repository.cs
index 9283a702..e48cf32e 100644
--- a/src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Repository.cs
+++ b/src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Repository.cs
@@ -50,7 +50,7 @@ public ValueTask> GetAllAsync(Expression
GetAllByProjectionAsync(s => s, filter, orderBy, descending, page, pageSize);
public async ValueTask> GetAllByProjectionAsync(
- Expression>? selector,
+ Expression> selector,
Expression>? filter = null,
Expression>? orderBy = null,
bool descending = true,