QueryR.EntityFrameworkCore 0.0.1

dotnet add package QueryR.EntityFrameworkCore --version 0.0.1
NuGet\Install-Package QueryR.EntityFrameworkCore -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QueryR.EntityFrameworkCore" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QueryR.EntityFrameworkCore --version 0.0.1
#r "nuget: QueryR.EntityFrameworkCore, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install QueryR.EntityFrameworkCore as a Cake Addin
#addin nuget:?package=QueryR.EntityFrameworkCore&version=0.0.1

// Install QueryR.EntityFrameworkCore as a Cake Tool
#tool nuget:?package=QueryR.EntityFrameworkCore&version=0.0.1

QueryR.EntityFrameworkCore

QueryR Logo

.NET

QueryR.EntityFrameworkCore adds a few important items into QueryR for use with EntityFrameworkCore.

Includes

QueryR.EntityFrameworkCore introduces a new EfQuery object that should be used for querying instead of the QueryR Query object.

The EfQuery object has an Includes member where the navigation property path can be set to include related entities with the query. It is important to use this setting for specifying Include statements as the values control the maximum search depth for the SparseFields.

Async QueryResult Extensions

QueryR.EntityFrameworkCore would not be complete without new QueryResult extension methods to call the CountAsync and ToListAsync extension methods provided by EntityFrameworkCore.

Web Api Example

public class KerbalsGet : BaseController
{
    [HttpGet(Routes.Api.Kerbals.Url)]
    public async Task<IActionResult> Action(Command command) => await Mediator.Send(command);
    public class Command : IRequest<IActionResult>
    {
        [FromQuery(Name = "")]
        public QueryParameters QueryParameters { get; set; } = new();
    }
    public class ResponseObject
    {
        public int TotalCount { get; set; }
        public List<Kerbal> Kerbals { get; set; }
    }
    public class Handler : IRequestHandler<Command, IActionResult>
    {
        public readonly IQueryParameterMapper queryParameterMapper;
        public readonly KspDbContext kspDbContext;
        public Handler(
            IQueryParameterMapper queryParameterMapper,
            KspDbContext kspDbContext
        )
        {
            this.queryParameterMapper = queryParameterMapper;
            this.kspDbContext = kspDbContext;
        }

        public async Task<IActionResult> Handle(Command request, CancellationToken cancellationToken)
        {
            var query = queryParameterMapper.MapToQuery(request.QueryParameters);

            var (totalCount, kerbals) = await kspDbContext.Set<Kerbal>().Query(query)
                .GetCountAndListAsync(cancellationToken);

            return new OkObjectResult(new ResponseObject {
                TotalCount = totalCount,
                Kerbals = kerbals
            });
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1 188 1/27/2023

Initial release of QueryR.EntityFrameworkCore