linq2db.Analyzers 6.4.0

Prefix Reserved
dotnet add package linq2db.Analyzers --version 6.4.0
                    
NuGet\Install-Package linq2db.Analyzers -Version 6.4.0
                    
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="linq2db.Analyzers" Version="6.4.0">
  <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="linq2db.Analyzers" Version="6.4.0" />
                    
Directory.Packages.props
<PackageReference Include="linq2db.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
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 linq2db.Analyzers --version 6.4.0
                    
#r "nuget: linq2db.Analyzers, 6.4.0"
                    
#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 linq2db.Analyzers@6.4.0
                    
#: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=linq2db.Analyzers&version=6.4.0
                    
Install as a Cake Addin
#tool nuget:?package=linq2db.Analyzers&version=6.4.0
                    
Install as a Cake Tool

linq2db.Analyzers

Roslyn analyzers and code fixes for linq2db users: they flag legacy API usage and offer automatic migrations to the current API. The package ships no runtime assembly.

You normally don't reference this package: linq2db depends on it, so the rules arrive with the library — including in a project that references only a satellite package (linq2db.Tools, linq2db.Remote.*, linq2db.EntityFrameworkCore). They require Roslyn 4.8 or later (.NET SDK 8.0+, Visual Studio 2022 17.8+) and are silently skipped on older toolchains.

Reference it directly only to run the rules against an older linq2db — e.g. to size and apply a migration before upgrading. It carries no linq2db dependency, so any combination restores:

<PackageReference Include="linq2db"           Version="6.3.0" />
<PackageReference Include="linq2db.Analyzers" Version="6.4.0" PrivateAssets="all" />

A rule withholds itself when the API it migrates to is absent from the compilation, so an analyzer newer than the runtime it runs against degrades to silence rather than to a broken fix.

Diagnostics

Id Severity Description
L2DB1001 Info Legacy Sql.Ext analytic / window-function API is superseded by Sql.Window. A code fix migrates convertible chains.

L2DB1001 — migrate Sql.Ext window functions to Sql.Window

// before
var r = Sql.Ext.RowNumber().Over().PartitionBy(x.Category).OrderBy(x.Date).ToValue();

// after (code fix)
var r = Sql.Window.RowNumber(f => f.PartitionBy(x.Category).OrderBy(x.Date));

The Sql.Ext window API still works but will be removed in a future major release. The code fix preserves your comments and formatting. Chains that have no direct Sql.Window equivalent (e.g. an aggregate without .Over()) are reported but left for you to migrate manually.

The code fix withholds itself when the Sql.Window return type differs from the legacy ToValue<TR>() slot (e.g. a double slot vs Sql.Window's double?), so it never turns compiling code into a type error. To apply it anyway and resolve the type change yourself, opt in (see below).

Configuration

Adjust severity in .editorconfig:

dotnet_diagnostic.L2DB1001.severity = warning

Every rule in this package is in the LinqToDB analyzer category, so one line sets them all:

dotnet_analyzer_diagnostic.category-LinqToDB.severity = warning

Apply the L2DB1001 fix even when the Sql.Window return type diverges from the legacy slot (default false; when enabled you resolve any resulting type change, e.g. widening int to long, by hand):

linq2db.L2DB1001.apply_fix_on_return_type_mismatch = true

Disable every rule of this package for a project — including when it arrives as a dependency of linq2db rather than as a direct reference:

<PropertyGroup>
	<EnableLinqToDBAnalyzers>false</EnableLinqToDBAnalyzers>
</PropertyGroup>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on linq2db.Analyzers:

Package Downloads
linq2db

LINQ to DB is a data access technology that provides a run-time infrastructure for managing relational data as objects.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.4.0 0 8/7/2026