Skip to content

feat: Upgrade major mongo version #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged

feat: Upgrade major mongo version #418

merged 1 commit into from
Apr 30, 2025

Conversation

linkdotnet
Copy link
Owner

No description provided.

@linkdotnet linkdotnet requested a review from Copilot April 30, 2025 19:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the major MongoDB version and updates repository interfaces and implementations to enforce non-null selector parameters while broadening the query extension method to work with generic IQueryable instances.

  • Updated selector parameter to be non-nullable in repository methods
  • Adjusted the ToPagedListAsync extension to use IQueryable
  • Added pragma directives in the MongoDB connection provider to suppress disposal warnings

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Repository.cs Updated selector parameter to non-nullable
src/LinkDotNet.Blog.Infrastructure/Persistence/RavenDb/Repository.cs Updated selector parameter to non-nullable
src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/Repository.cs Updated selector parameter to non-nullable and improved method chaining for readability
src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/PaginatedListQueryExtensions.cs Changed extension method signature from IMongoQueryable to IQueryable
src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/MongoDBConnectionProvider.cs Added pragma directives to suppress disposal warnings
src/LinkDotNet.Blog.Infrastructure/Persistence/IRepository.cs Updated selector parameter to non-nullable
src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs Updated selector parameter to non-nullable
Files not reviewed (1)
  • Directory.Packages.props: Language not supported
Comments suppressed due to low confidence (1)

src/LinkDotNet.Blog.Infrastructure/Persistence/MongoDB/PaginatedListQueryExtensions.cs:10

  • Changing the extension method to accept IQueryable rather than IMongoQueryable broadens usage, but verify that MongoDB-specific query optimizations are not inadvertently affected.
public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, int pageIndex, int pageSize, CancellationToken token = default)

@@ -50,7 +50,7 @@ public ValueTask<IPagedList<TEntity>> GetAllAsync(Expression<Func<TEntity, bool>
GetAllByProjectionAsync(s => s, filter, orderBy, descending, page, pageSize);

Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The selector parameter is now non-nullable; ensure that all consumers of this repository pass a valid non-null selector expression.

Suggested change
/// <summary>
/// Retrieves a paginated list of entities projected to a specific type.
/// The selector parameter must not be null.
/// </summary>

Copilot uses AI. Check for mistakes.

@@ -47,7 +47,7 @@ public ValueTask<IPagedList<TEntity>> GetAllAsync(Expression<Func<TEntity, bool>
GetAllByProjectionAsync(s => s, filter, orderBy, descending, page, pageSize);
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The selector parameter is now required; update any RavenDB repository calls to supply a non-null expression.

Suggested change
GetAllByProjectionAsync(s => s, filter, orderBy, descending, page, pageSize);
GetAllByProjectionAsync(selector: s => s, filter, orderBy, descending, page, pageSize);

Copilot uses AI. Check for mistakes.

@@ -51,7 +52,7 @@ public async ValueTask<IPagedList<TEntity>> GetAllAsync(Expression<Func<TEntity,
await GetAllByProjectionAsync(s => s, filter, orderBy, descending, page, pageSize);

public async ValueTask<IPagedList<TProjection>> GetAllByProjectionAsync<TProjection>(
Expression<Func<TEntity, TProjection>>? selector,
Expression<Func<TEntity, TProjection>> selector,
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to a non-nullable selector enforces that a valid projection is always provided; confirm that downstream callers are updated accordingly.

Copilot uses AI. Check for mistakes.

@@ -22,7 +22,7 @@ ValueTask<IPagedList<TEntity>> GetAllAsync(
int pageSize = int.MaxValue);

ValueTask<IPagedList<TProjection>> GetAllByProjectionAsync<TProjection>(
Expression<Func<TEntity, TProjection>>? selector,
Expression<Func<TEntity, TProjection>> selector,
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By removing the nullable annotation, the repository interface now requires a non-null selector; ensure that implementations and consumers are consistent with this change.

Suggested change
Expression<Func<TEntity, TProjection>> selector,
Expression<Func<TEntity, TProjection>> selector, // Must not be null

Copilot uses AI. Check for mistakes.

@@ -37,7 +37,7 @@ public async ValueTask<IPagedList<T>> GetAllAsync(Expression<Func<T, bool>>? fil
await repository.GetAllAsync(filter, orderBy, descending, page, pageSize);

public async ValueTask<IPagedList<TProjection>> GetAllByProjectionAsync<TProjection>(
Expression<Func<T, TProjection>>? selector,
Expression<Func<T, TProjection>> selector,
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated non-nullable selector parameter mandates that a projection must always be provided; verify that cached calls conform to this requirement.

Copilot uses AI. Check for mistakes.

@linkdotnet linkdotnet merged commit 3f67611 into master Apr 30, 2025
3 checks passed
@linkdotnet linkdotnet deleted the mongo-upgrade branch April 30, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant