Linqraft.SourceGenerator
0.4.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Linqraft.SourceGenerator --version 0.4.2
NuGet\Install-Package Linqraft.SourceGenerator -Version 0.4.2
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="Linqraft.SourceGenerator" Version="0.4.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linqraft.SourceGenerator" Version="0.4.2" />
<PackageReference Include="Linqraft.SourceGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Linqraft.SourceGenerator --version 0.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Linqraft.SourceGenerator, 0.4.2"
#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.
#:package Linqraft.SourceGenerator@0.4.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Linqraft.SourceGenerator&version=0.4.2
#tool nuget:?package=Linqraft.SourceGenerator&version=0.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Linqraft
Write Select queries easily with on-demand DTO generation and null-coalescing operators. No depedendencies.
For Example:
var orders = await dbContext.Orders
// Order: input entity type
// OrderDto: output DTO type (auto-generated)
.SelectExpr<Order, OrderDto>(o => new
{
// can use inferred member names
o.Id,
// null-propagation supported
CustomerName = o.Customer?.Name,
// also works for nested objects
CustomerCountry = o.Customer?.Address?.Country?.Name,
CustomerCity = o.Customer?.Address?.City?.Name,
// you can use anonymous types inside
CustomerInfo = new
{
Email = o.Customer?.EmailAddress,
Phone = o.Customer?.PhoneNumber,
},
// collections available
Items = o.OrderItems.Select(oi => new
{
// of course, features work here too
ProductName = oi.Product?.Name,
oi.Quantity
}),
})
.ToListAsync();
will be generated as:
// <auto-generated />
#nullable enable
#pragma warning disable IDE0060
#pragma warning disable CS8601
#pragma warning disable CS8602
#pragma warning disable CS8603
#pragma warning disable CS8604
#pragma warning disable CS8618
using System;
using System.Linq;
using System.Collections.Generic;
namespace Linqraft
{
file static partial class GeneratedExpression
{
/// <summary>
/// generated select expression method OrderDto (explicit) <br/>
/// at TutorialCaseTest.cs(17,14)
/// </summary>
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "1rTP47TjaPKlTizGJTAHaXsBAABUdXRvcmlhbENhc2VUZXN0LmNz")]
public static IQueryable<TResult> SelectExpr_54EA5DDB_8D42F5FB<TIn, TResult>(
this IQueryable<TIn> query, Func<TIn, object> selector)
{
var matchedQuery = query as object as IQueryable<global::Tutorial.Order>;
var converted = matchedQuery.Select(o => new global::Tutorial.OrderDto
{
Id = o.Id,
CustomerName = o.Customer != null ? (string?)o.Customer.Name : null,
CustomerCountry = o.Customer != null && o.Customer.Address != null && o.Customer.Address.Country != null ? (string?)o.Customer.Address.Country.Name : null,
CustomerCity = o.Customer != null && o.Customer.Address != null && o.Customer.Address.City != null ? (string?)o.Customer.Address.City.Name : null,
CustomerInfo = new global::Tutorial.CustomerInfoDto_F1A64BF4
{
Email = o.Customer != null ? (string?)o.Customer.EmailAddress : null,
Phone = o.Customer != null ? (string?)o.Customer.PhoneNumber : null
},
Items = o.OrderItems.Select(oi => new global::Tutorial.OrderItemDto_DE33EA40
{
ProductName = oi.Product != null ? (string?)oi.Product.Name : null,
Quantity = oi.Quantity
})
});
return converted as object as IQueryable<TResult>;
}
}
}
namespace Tutorial
{
public partial class CustomerInfoDto_F1A64BF4
{
public required string? Email { get; set; }
public required string? Phone { get; set; }
}
public partial class OrderItemDto_DE33EA40
{
public required string? ProductName { get; set; }
public required int Quantity { get; set; }
}
public partial class OrderDto
{
public required int Id { get; set; }
public required string? CustomerName { get; set; }
public required string? CustomerCountry { get; set; }
public required string? CustomerCity { get; set; }
public required global::Tutorial.CustomerInfoDto_F1A64BF4? CustomerInfo { get; set; }
public required global::System.Collections.Generic.List<Tutorial.OrderItemDto_DE33EA40> Items { get; set; }
}
}
See the GitHub Repository for more details.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
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.10.54-rc.1 | 66 | 3/17/2026 |
| 0.10.18-beta.6.ge1812abb7f | 62 | 3/11/2026 |
| 0.10.10-beta.5.ge6f72fac71 | 64 | 3/10/2026 |
| 0.10.8-beta.4.gae1742429a | 61 | 3/10/2026 |
| 0.10.8-beta.3.g3fe95d99c0 | 57 | 3/10/2026 |
| 0.10.6-beta.2.g0c6b0f58c5 | 61 | 3/9/2026 |
| 0.10.1-beta.1.g954d3ba0b1 | 55 | 3/9/2026 |
| 0.8.1 | 117 | 3/2/2026 |
| 0.8.0 | 110 | 2/4/2026 |
| 0.7.1 | 102 | 2/3/2026 |
| 0.7.0 | 196 | 12/22/2025 |
| 0.6.2 | 445 | 12/10/2025 |
| 0.6.1 | 184 | 12/5/2025 |
| 0.6.0 | 671 | 12/3/2025 |
| 0.5.3 | 680 | 12/3/2025 |
| 0.5.2 | 682 | 12/3/2025 |
| 0.5.1 | 673 | 12/2/2025 |
| 0.5.0 | 671 | 12/2/2025 |
| 0.4.3 | 677 | 12/2/2025 |
| 0.4.2 | 579 | 12/1/2025 |
Loading failed