Skip to content
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

PagedList with include fails when TenantId is mapped to document #3274

Closed
mtech-mrajahalme opened this issue Jun 20, 2024 · 0 comments
Closed

Comments

@mtech-mrajahalme
Copy link
Contributor

mtech-mrajahalme commented Jun 20, 2024

When using conjoined tenancy and mapping the TenantId to the document with the following configuration:

  opts.Schema
      .For<User>()
      .Metadata(a => a.TenantId.MapTo(x => x.TenantId));

and then fetching the documents with the following query:

  var userDict = new Dictionary<Guid, UserState>();

  var document = await session
      .Query<User>()
      .Include(x => x.Id, userDict)
      .Where(a => a.Id == newUser.Id)
      .ToPagedListAsync(1,10);

Results in a exception System.NotSupportedException : Specified method is not supported.

Stack Trace: 

DuplicatedFieldSelectClause.UseStatistics(QueryStatistics statistics) line 490
CollectionUsage.BuildTopStatement(IMartenSession session, IQueryableMemberCollection collection, IDocumentStorage storage, QueryStatistics statistics) line 59
LinqQueryParser.BuildStatements() line 33
LinqQueryParser.BuildListHandler[T]() line 71
MartenLinqQueryable`1.ToListAsync[TResult](CancellationToken token) line 0
PagedList`1.InitAsync(IQueryable`1 queryable, Int32 pageNumber, Int32 pageSize, CancellationToken token) line 160
PagedList`1.CreateAsync(IQueryable`1 queryable, Int32 pageNumber, Int32 pageSize, CancellationToken token) line 130
PagedListQueryableExtensions.ToPagedListAsync[T](IQueryable`1 queryable, Int32 pageNumber, Int32 pageSize, CancellationToken token) line 47

Here is a pull request with a test reproducing the issue.
#3275

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

No branches or pull requests

1 participant