RSCG_DBContext 2026.914.1850
dotnet add package RSCG_DBContext --version 2026.914.1850
NuGet\Install-Package RSCG_DBContext -Version 2026.914.1850
<PackageReference Include="RSCG_DBContext" Version="2026.914.1850"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="RSCG_DBContext" Version="2026.914.1850" />
<PackageReference Include="RSCG_DBContext"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add RSCG_DBContext --version 2026.914.1850
#r "nuget: RSCG_DBContext, 2026.914.1850"
#:package RSCG_DBContext@2026.914.1850
#addin nuget:?package=RSCG_DBContext&version=2026.914.1850
#tool nuget:?package=RSCG_DBContext&version=2026.914.1850
RSCG_DBContext
A Roslyn incremental source generator that augments your Entity Framework Core DbContext with Exists_* helper methods, letting you check whether a table/DbSet (or the whole database) is reachable without writing that boilerplate by hand.
What it generates
Given:
using RSCG_DBContext;
[GenerateDbContextExists]
public partial class EmpContext : DbContext
{
public DbSet<Employee> Employees { get; set; }
public DbSet<Department> Departments { get; set; }
}
the generator emits a partial class with one Exists_<DbSetName>() method per DbSet<T> property, plus an Exists_AllDBSets() helper that checks them all:
public partial class EmpContext
{
public bool Exists_Employees() { /* returns true if the table can be queried */ }
public bool Exists_Departments() { /* returns true if the table can be queried */ }
public bool Exists_AllDBSets() { /* returns true only if every Exists_* above returns true */ }
public IEnumerable<string> Problem_DBSets() { /* yields the DbSet property name for each DbSet that fails its Exists_* check */ }
}
Requirements
- The class must inherit from
Microsoft.EntityFrameworkCore.DbContext. - The class must be declared
partial(a diagnostic,RSCGDB002, is reported otherwise). - Applying
[GenerateDbContextExists]to a non-DbContextclass reports diagnosticRSCGDB001.
Installation
Install the NuGet package as an analyzer-only, build-time dependency:
dotnet add package RSCG_DBContext
Because the package ships only as a Roslyn analyzer/source generator (no runtime assembly), it is automatically marked as a development dependency and won't add a runtime reference to your published output.
Usage
- Reference
Microsoft.EntityFrameworkCorein your project as usual. - Add the
[GenerateDbContextExists]attribute (from theRSCG_DBContextnamespace) to yourpartialDbContextclass. - Build the project — the generated
Exists_*members become available on your context. - Use
Problem_DBSets()to enumerate, by property name, only theDbSets that are currently unreachable — handy for diagnosing which table(s) causedExists_AllDBSets()to returnfalse.
See ExampleProject for a full sample and tests/RSCG_DBContext.Tests for generator unit tests.
Building and packing locally
dotnet build RSCG_DBContext.slnx
dotnet pack src\RSCG_DBContext\RSCG_DBContext.csproj -c Release -o .\nupkg
The resulting .nupkg places RSCG_DBContext.dll under analyzers/dotnet/cs (loaded by the compiler as an analyzer) with no lib/ assemblies, so consuming projects only get the source generator at compile time.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- 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 |
|---|---|---|
| 2026.914.1850 | 49 | 9/14/2026 |