QueryR.EntityFrameworkCore
0.0.1
See the version list below for details.
dotnet add package QueryR.EntityFrameworkCore --version 0.0.1
NuGet\Install-Package QueryR.EntityFrameworkCore -Version 0.0.1
<PackageReference Include="QueryR.EntityFrameworkCore" Version="0.0.1" />
paket add QueryR.EntityFrameworkCore --version 0.0.1
#r "nuget: QueryR.EntityFrameworkCore, 0.0.1"
// 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.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 | Versions 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. |
-
net6.0
- Microsoft.EntityFrameworkCore (>= 7.0.2)
- QueryR (>= 0.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of QueryR.EntityFrameworkCore