ffernandolima / ef-core-data-access

It's a modern and generic data access structure for .NET and Microsoft.EntityFrameworkCore. It supports UnitOfWork, Repository and QueryBuilder patterns. It also includes auto history utilities, multiple databases support with distributed transactions and databases/tables sharding for some database providers.
MIT License
165 stars 25 forks source link

[question] What about `SelectMany`? #14

Closed igor-lukashenya closed 2 years ago

igor-lukashenya commented 2 years ago

Hi, I want to ask about SelectMany?

Are there any alternative or implementation for SelectMany?

ffernandolima commented 2 years ago

Hi!

For complex query operators like SelectMany a custom repository should be used instead.

There's an example here demonstrating how to create a custom repository and use all available features from DbSet and/or IQueryable.

The custom repository can be instantiated through IUnitOfWork which inherits from IRepositoryFactory, by accessing CustomRepository available method.

Example:

// Example: Custom Repository
var repository = _unitOfWork.CustomRepository<ICustomBlogRepository>();

var urls = await repository.GetAllBlogUrlsAsync()
      .ConfigureAwait(continueOnCapturedContext: false);

Also, the SelectMany official documentation can be found out here.