RSCG_DBContext 2026.914.1850

dotnet add package RSCG_DBContext --version 2026.914.1850
                    
NuGet\Install-Package RSCG_DBContext -Version 2026.914.1850
                    
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="RSCG_DBContext" Version="2026.914.1850">
  <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="RSCG_DBContext" Version="2026.914.1850" />
                    
Directory.Packages.props
<PackageReference Include="RSCG_DBContext">
  <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 RSCG_DBContext --version 2026.914.1850
                    
#r "nuget: RSCG_DBContext, 2026.914.1850"
                    
#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 RSCG_DBContext@2026.914.1850
                    
#: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=RSCG_DBContext&version=2026.914.1850
                    
Install as a Cake Addin
#tool nuget:?package=RSCG_DBContext&version=2026.914.1850
                    
Install as a Cake Tool

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-DbContext class reports diagnostic RSCGDB001.

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

  1. Reference Microsoft.EntityFrameworkCore in your project as usual.
  2. Add the [GenerateDbContextExists] attribute (from the RSCG_DBContext namespace) to your partial DbContext class.
  3. Build the project — the generated Exists_* members become available on your context.
  4. Use Problem_DBSets() to enumerate, by property name, only the DbSets that are currently unreachable — handy for diagnosing which table(s) caused Exists_AllDBSets() to return false.

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.

There are no supported framework assets in this package.

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